def test_diffvalues(): table1 = (('foo', 'bar'), ('a', 1), ('b', 3)) table2 = (('bar', 'foo'), (1, 'a'), (3, 'c')) add, sub = diffvalues(table1, table2, 'foo') assertequal({'c'}, add) assertequal({'b'}, sub)
def test_diffvalues(): table1 = (('foo', 'bar'), ('a', 1), ('b', 3)) table2 = (('bar', 'foo'), (1, 'a'), (3, 'c')) add, sub = diffvalues(table1, table2, 'foo') eq_(set(['c']), add) eq_(set(['b']), sub)
def test_diffvalues(): table1 = (("foo", "bar"), ("a", 1), ("b", 3)) table2 = (("bar", "foo"), (1, "a"), (3, "c")) add, sub = diffvalues(table1, table2, "foo") eq_(set(["c"]), add) eq_(set(["b"]), sub)
add, sub = etl.diffheaders(table1, table2) add sub # diffvalues() ############## import petl as etl table1 = [['foo', 'bar'], ['a', 1], ['b', 3]] table2 = [['bar', 'foo'], [1, 'a'], [3, 'c']] add, sub = etl.diffvalues(table1, table2, 'foo') add sub # nthword() ########### import petl as etl s = 'foo bar' f = etl.nthword(0) f(s) g = etl.nthword(1) g(s)
# diffheaders() ############### import petl as etl table1 = [['foo', 'bar', 'baz'], ['a', 1, .3]] table2 = [['baz', 'bar', 'quux'], ['a', 1, .3]] add, sub = etl.diffheaders(table1, table2) add sub # diffvalues() ############## import petl as etl table1 = [['foo', 'bar'], ['a', 1], ['b', 3]] table2 = [['bar', 'foo'], [1, 'a'], [3, 'c']] add, sub = etl.diffvalues(table1, table2, 'foo') add sub # nthword() ########### import petl as etl s = 'foo bar' f = etl.nthword(0) f(s) g = etl.nthword(1) g(s)