Ejemplo n.º 1
0
def test_indexedstreamingdifftracker_only_new():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 3)
    tracker.push_new([('a', 0), ('b', 1), ('c', 2)])
    tracker.push_old([])
    tracker.done()

    assert added == ['a', 'b', 'c']
Ejemplo n.º 2
0
def test_indexedstreamingdifftracker_only_new():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 3)
    tracker.push_new([("a", 0), ("b", 1), ("c", 2)])
    tracker.push_old([])
    tracker.done()

    assert added == ["a", "b", "c"]
Ejemplo n.º 3
0
def test_indexedstreamingdifftracker_high_old_bound():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([('z', 26), ('hello', 100)])
    tracker.push_old([('end1', 999), ('end2', 1000)])

    tracker.push_new([])
    tracker.push_old([])

    tracker.done()

    assert added == ['z', 'hello']
Ejemplo n.º 4
0
def test_indexedstreamingdifftracker_old_pagination():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([('a', 10), ('b', 11)])
    tracker.push_old([('z', 1), ('y', 2)])

    tracker.push_new([('c', 12)])
    tracker.push_old([('a', 10)])

    tracker.done()

    assert added == ['b', 'c']
Ejemplo n.º 5
0
def test_indexedstreamingdifftracker_old_pagination_no_repeat():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([('new1', 3), ('new2', 4)])
    tracker.push_old([('old1', 1), ('old2', 2)])

    tracker.push_new([])
    tracker.push_old([('new1', 3)])

    tracker.done()

    assert added == ['new2']
Ejemplo n.º 6
0
def test_indexedstreamingdifftracker_high_old_bound():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([("z", 26), ("hello", 100)])
    tracker.push_old([("end1", 999), ("end2", 1000)])

    tracker.push_new([])
    tracker.push_old([])

    tracker.done()

    assert added == ["z", "hello"]
Ejemplo n.º 7
0
def test_indexedstreamingdifftracker_old_pagination():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([("a", 10), ("b", 11)])
    tracker.push_old([("z", 1), ("y", 2)])

    tracker.push_new([("c", 12)])
    tracker.push_old([("a", 10)])

    tracker.done()

    assert added == ["b", "c"]
Ejemplo n.º 8
0
def test_indexedstreamingdifftracker_old_pagination_no_repeat():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([("new1", 3), ("new2", 4)])
    tracker.push_old([("old1", 1), ("old2", 2)])

    tracker.push_new([])
    tracker.push_old([("new1", 3)])

    tracker.done()

    assert added == ["new2"]
Ejemplo n.º 9
0
def test_indexedstreamingdifftracker_many_old():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([('z', 26), ('hello', 100)])
    tracker.push_old([('a', 1), ('b', 2)])

    tracker.push_new([])
    tracker.push_old([('c', 1), ('d', 2)])

    tracker.push_new([])
    tracker.push_old([('e', 3), ('f', 4)])

    tracker.push_new([])
    tracker.push_old([('g', 5), ('z', 26)])

    tracker.done()

    assert added == ['hello']
Ejemplo n.º 10
0
def test_indexedstreamingdifftracker_many_old():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([("z", 26), ("hello", 100)])
    tracker.push_old([("a", 1), ("b", 2)])

    tracker.push_new([])
    tracker.push_old([("c", 1), ("d", 2)])

    tracker.push_new([])
    tracker.push_old([("e", 3), ("f", 4)])

    tracker.push_new([])
    tracker.push_old([("g", 5), ("z", 26)])

    tracker.done()

    assert added == ["hello"]
Ejemplo n.º 11
0
def test_indexedstreamingdifftracker_very_offset():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([('a', 10), ('b', 11)])
    tracker.push_old([('z', 1), ('y', 2)])

    tracker.push_new([('c', 12), ('d', 13)])
    tracker.push_old([('x', 3), ('w', 4)])

    tracker.push_new([('e', 14)])
    tracker.push_old([('a', 10), ('d', 13)])

    tracker.done()

    assert added == ['b', 'c', 'e']
Ejemplo n.º 12
0
def test_indexedstreamingdifftracker_very_offset():
    added = []

    tracker = IndexedStreamingDiffTracker(added.append, 2)
    tracker.push_new([("a", 10), ("b", 11)])
    tracker.push_old([("z", 1), ("y", 2)])

    tracker.push_new([("c", 12), ("d", 13)])
    tracker.push_old([("x", 3), ("w", 4)])

    tracker.push_new([("e", 14)])
    tracker.push_old([("a", 10), ("d", 13)])

    tracker.done()

    assert added == ["b", "c", "e"]