Exemple #1
0
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)
Exemple #2
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)
Exemple #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)
Exemple #4
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)
Exemple #5
0
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)
Exemple #6
0
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)
Exemple #7
0
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)
Exemple #8
0
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)
Exemple #9
0
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)
Exemple #10
0
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)
Exemple #11
0
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)
Exemple #12
0
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)