alimanfoo/petl — Issue #1: diff not showing subtractions
Author: zigen
Created: 2012-03-05 14:38:58+00:00
State: open

Trying out your module, I notice that diff are not showing subtractions when the changed file does not have lines from the original. I assume that if the change file does not have the same lines as the original file, you should see a subtractions. Could you please take a look into this?

# Test Code

from petl import *

f1 = fromcsv('list1', delimiter=',')
f2 = fromcsv('list2', delimiter=',')

print '- file 1'
for i in f1:
print i
print ''
print '- file 2'
for i in f2:
print i

print ''
print '#'
print '#'
print ''

a,s = diff(f1, f2)
print look(a)
print look(s)

print '#'

a,s = recorddiff(f1, f2)
print look(a)
print look(s)

# OUTPUT

$ ./test.py
- file1
('h1', 'h2')
('test1', 'hello1')
('test2', 'hello2')

-file2
('h1', 'h2')

################
################

+------+------+
| 'h1' | 'h2' |
+======+======+

+------+------+
| 'h1' | 'h2' |
+======+======+

################
+------+------+
| 'h1' | 'h2' |
+======+======+

+------+------+
| 'h1' | 'h2' |
+======+======+