Esempio n. 1
0
    def test_subtract_2():

        left = (('begin', 'end', 'label'), (1, 6, 'apple'), (3, 6, 'orange'),
                (5, 9, 'banana'))

        right = (('start', 'stop', 'foo'), (3, 4, True), (5, 6, True))

        expect = (('begin', 'end', 'label'), (1, 3, 'apple'), (4, 5, 'apple'),
                  (4, 5, 'orange'), (6, 9, 'banana'))

        actual = intervalsubtract(left,
                                  right,
                                  lstart='begin',
                                  lstop='end',
                                  rstart='start',
                                  rstop='stop')

        ieq(expect, actual)
        ieq(expect, actual)
Esempio n. 2
0
    def test_subtract_1():

        left = (('begin', 'end', 'label'),
                (1, 6, 'apple'),
                (3, 6, 'orange'),
                (5, 9, 'banana'))

        right = (('start', 'stop', 'foo'),
                 (3, 4, True))

        expect = (('begin', 'end', 'label'),
                  (1, 3, 'apple'),
                  (4, 6, 'apple'),
                  (4, 6, 'orange'),
                  (5, 9, 'banana'))

        actual = intervalsubtract(left, right,
                                  lstart='begin', lstop='end',
                                  rstart='start', rstop='stop')

        ieq(expect, actual)
        ieq(expect, actual)
Esempio n. 3
0
    def test_subtract_faceted():

        left = (('region', 'begin', 'end', 'label'),
                ('north', 1, 6, 'apple'),
                ('south', 3, 6, 'orange'),
                ('west', 5, 9, 'banana'))

        right = (('place', 'start', 'stop', 'foo'),
                 ('south', 3, 4, True),
                 ('north', 5, 6, True))

        expect = (('region', 'begin', 'end', 'label'),
                  ('north', 1, 5, 'apple'),
                  ('south', 4, 6, 'orange'),
                  ('west', 5, 9, 'banana'))

        actual = intervalsubtract(left, right,
                                  lkey='region', rkey='place',
                                  lstart='begin', lstop='end',
                                  rstart='start', rstop='stop')

        ieq(expect, actual)
        ieq(expect, actual)
Esempio n. 4
0
    def test_subtract_faceted():

        left = (('region', 'begin', 'end', 'label'), ('north', 1, 6, 'apple'),
                ('south', 3, 6, 'orange'), ('west', 5, 9, 'banana'))

        right = (('place', 'start', 'stop', 'foo'), ('south', 3, 4, True),
                 ('north', 5, 6, True))

        expect = (('region', 'begin', 'end', 'label'), ('north', 1, 5,
                                                        'apple'),
                  ('south', 4, 6, 'orange'), ('west', 5, 9, 'banana'))

        actual = intervalsubtract(left,
                                  right,
                                  lkey='region',
                                  rkey='place',
                                  lstart='begin',
                                  lstop='end',
                                  rstart='start',
                                  rstop='stop')

        ieq(expect, actual)
        ieq(expect, actual)