コード例 #1
0
ファイル: test_setops.py プロジェクト: DeanWay/petl
def test_recordcomplement_4():

    # test behaviour with duplicate rows

    table1 = (('foo', 'bar'),
              ('A', 1),
              ('B', 2),
              ('B', 2),
              ('C', 7))

    table2 = (('bar', 'foo'),
              (2, 'B'))

    result = recordcomplement(table1, table2)
    expectation = (('foo', 'bar'),
                   ('A', 1),
                   ('B', 2),
                   ('C', 7))
    ieq(expectation, result)
    ieq(expectation, result)

    # strict behaviour
    result = recordcomplement(table1, table2, strict=True)
    expectation = (('foo', 'bar'),
                   ('A', 1),
                   ('C', 7))
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #2
0
ファイル: test_setops.py プロジェクト: DeanWay/petl
def test_recordcomplement_2():

    tablea = (('foo', 'bar', 'baz'),
              ('A', 1, True),
              ('C', 7, False),
              ('B', 2, False),
              ('C', 9, True))

    tableb = (('bar', 'foo', 'baz'),
              (2, 'B', False),
              (9, 'A', False),
              (3, 'B', True),
              (9, 'C', True))

    aminusb = (('foo', 'bar', 'baz'),
               ('A', 1, True),
               ('C', 7, False))

    result = recordcomplement(tablea, tableb)
    ieq(aminusb, result)

    bminusa = (('bar', 'foo', 'baz'),
               (3, 'B', True),
               (9, 'A', False))

    result = recordcomplement(tableb, tablea)
    ieq(bminusa, result)
コード例 #3
0
def test_recordcomplement_2():

    tablea = (('foo', 'bar', 'baz'),
              ('A', 1, True),
              ('C', 7, False),
              ('B', 2, False),
              ('C', 9, True))

    tableb = (('bar', 'foo', 'baz'),
              (2, 'B', False),
              (9, 'A', False),
              (3, 'B', True),
              (9, 'C', True))

    aminusb = (('foo', 'bar', 'baz'),
               ('A', 1, True),
               ('C', 7, False))

    result = recordcomplement(tablea, tableb)
    ieq(aminusb, result)

    bminusa = (('bar', 'foo', 'baz'),
               (3, 'B', True),
               (9, 'A', False))

    result = recordcomplement(tableb, tablea)
    ieq(bminusa, result)
コード例 #4
0
ファイル: test_setops.py プロジェクト: pombredanne/petl
def test_recordcomplement_2():

    tablea = (("foo", "bar", "baz"), ("A", 1, True), ("C", 7, False), ("B", 2, False), ("C", 9, True))

    tableb = (("bar", "foo", "baz"), (2, "B", False), (9, "A", False), (3, "B", True), (9, "C", True))

    aminusb = (("foo", "bar", "baz"), ("A", 1, True), ("C", 7, False))

    result = recordcomplement(tablea, tableb)
    ieq(aminusb, result)

    bminusa = (("bar", "foo", "baz"), (3, "B", True), (9, "A", False))

    result = recordcomplement(tableb, tablea)
    ieq(bminusa, result)
コード例 #5
0
ファイル: test_setops.py プロジェクト: larissarmp/TCC
def test_recordcomplement_3():

    # make sure we deal with empty tables

    table1 = (('foo', 'bar'), ('A', 1), ('B', 2))

    table2 = (('bar', 'foo'), )

    expectation = (('foo', 'bar'), ('A', 1), ('B', 2))
    result = recordcomplement(table1, table2)
    ieq(expectation, result)
    ieq(expectation, result)

    expectation = (('bar', 'foo'), )
    result = recordcomplement(table2, table1)
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #6
0
ファイル: test_setops.py プロジェクト: pombredanne/petl
def test_recordcomplement_3():

    # make sure we deal with empty tables

    table1 = (("foo", "bar"), ("A", 1), ("B", 2))

    table2 = (("bar", "foo"),)

    expectation = (("foo", "bar"), ("A", 1), ("B", 2))
    result = recordcomplement(table1, table2)
    ieq(expectation, result)
    ieq(expectation, result)

    expectation = (("bar", "foo"),)
    result = recordcomplement(table2, table1)
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #7
0
ファイル: test_setops.py プロジェクト: larissarmp/TCC
def test_recordcomplement_4():

    # test behaviour with duplicate rows

    table1 = (('foo', 'bar'), ('A', 1), ('B', 2), ('B', 2), ('C', 7))

    table2 = (('bar', 'foo'), (2, 'B'))

    result = recordcomplement(table1, table2)
    expectation = (('foo', 'bar'), ('A', 1), ('B', 2), ('C', 7))
    ieq(expectation, result)
    ieq(expectation, result)

    # strict behaviour
    result = recordcomplement(table1, table2, strict=True)
    expectation = (('foo', 'bar'), ('A', 1), ('C', 7))
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #8
0
ファイル: test_setops.py プロジェクト: larissarmp/TCC
def test_recordcomplement_1():

    table1 = (('foo', 'bar'), ('A', 1), ('B', 2), ('C', 7))

    table2 = (('bar', 'foo'), (9, 'A'), (2, 'B'), (3, 'B'))

    expectation = (('foo', 'bar'), ('A', 1), ('C', 7))

    result = recordcomplement(table1, table2)
    ieq(expectation, result)
コード例 #9
0
ファイル: test_setops.py プロジェクト: pombredanne/petl
def test_recordcomplement_1():

    table1 = (("foo", "bar"), ("A", 1), ("B", 2), ("C", 7))

    table2 = (("bar", "foo"), (9, "A"), (2, "B"), (3, "B"))

    expectation = (("foo", "bar"), ("A", 1), ("C", 7))

    result = recordcomplement(table1, table2)
    ieq(expectation, result)
コード例 #10
0
ファイル: test_setops.py プロジェクト: DeanWay/petl
def test_recordcomplement_3():

    # make sure we deal with empty tables

    table1 = (('foo', 'bar'),
              ('A', 1),
              ('B', 2))

    table2 = (('bar', 'foo'),)

    expectation = (('foo', 'bar'),
                   ('A', 1),
                   ('B', 2))
    result = recordcomplement(table1, table2)
    ieq(expectation, result)
    ieq(expectation, result)

    expectation = (('bar', 'foo'),)
    result = recordcomplement(table2, table1)
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #11
0
ファイル: test_setops.py プロジェクト: pombredanne/petl
def test_recordcomplement_4():

    # test behaviour with duplicate rows

    table1 = (("foo", "bar"), ("A", 1), ("B", 2), ("B", 2), ("C", 7))

    table2 = (("bar", "foo"), (2, "B"))

    expectation = (("foo", "bar"), ("A", 1), ("B", 2), ("C", 7))

    result = recordcomplement(table1, table2)
    ieq(expectation, result)
    ieq(expectation, result)
コード例 #12
0
ファイル: test_setops.py プロジェクト: DeanWay/petl
def test_recordcomplement_1():

    table1 = (('foo', 'bar'),
              ('A', 1),
              ('B', 2),
              ('C', 7))

    table2 = (('bar', 'foo'),
              (9, 'A'),
              (2, 'B'),
              (3, 'B'))

    expectation = (('foo', 'bar'),
                   ('A', 1),
                   ('C', 7))

    result = recordcomplement(table1, table2)
    ieq(expectation, result)