Пример #1
0
def test_intervalantijoin_faceted():

    left = (('fruit', 'begin', 'end'),
            ('apple', 1, 2),
            ('apple', 2, 4),
            ('apple', 2, 5),
            ('orange', 2, 5),
            ('orange', 9, 14),
            ('orange', 19, 140),
            ('apple', 1, 1),
            ('apple', 2, 2),
            ('apple', 4, 4),
            ('apple', 5, 5),
            ('orange', 5, 5))

    right = (('type', 'start', 'stop', 'value'),
             ('apple', 1, 4, 'foo'),
             ('apple', 3, 7, 'bar'),
             ('orange', 4, 9, 'baz'))

    expect = (('fruit', 'begin', 'end'),
              ('orange', 9, 14),
              ('orange', 19, 140),
              ('apple', 1, 1))

    actual = intervalantijoin(left, right, lstart='begin', lstop='end',
                              rstart='start', rstop='stop', lfacet='fruit',
                              rfacet='type')

    ieq(expect, actual)
    ieq(expect, actual)
Пример #2
0
def test_intervalantijoin():

    left = (('begin', 'end', 'quux'),
            (1, 2, 'a'),
            (2, 4, 'b'),
            (2, 5, 'c'),
            (9, 14, 'd'),
            (9, 140, 'e'),
            (1, 1, 'f'),
            (2, 2, 'g'),
            (4, 4, 'h'),
            (5, 5, 'i'),
            (1, 8, 'j'))

    right = (('start', 'stop', 'value'),
             (1, 4, 'foo'),
             (3, 7, 'bar'),
             (4, 9, 'baz'))

    actual = intervalantijoin(left, right,
                              lstart='begin', lstop='end',
                              rstart='start', rstop='stop')
    expect = (('begin', 'end', 'quux'),
              (9, 14, 'd'),
              (9, 140, 'e'),
              (1, 1, 'f'))
    ieq(expect, actual)
    ieq(expect, actual)