Esempio n. 1
0
def test_streamingdifftracker_offset_new():
    added = []

    tracker = StreamingDiffTracker(added.append, 5)
    tracker.push_new(['b', 'c', 'd', 'e'])
    tracker.push_old(['a', 'b', 'c'])
    tracker.done()

    assert added == ['d', 'e']
Esempio n. 2
0
def test_streamingdifftracker_offset_new():
    added = []

    tracker = StreamingDiffTracker(added.append, 5)
    tracker.push_new(["b", "c", "d", "e"])
    tracker.push_old(["a", "b", "c"])
    tracker.done()

    assert added == ["d", "e"]
Esempio n. 3
0
def test_streamingdifftracker_same_streams():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(['a', 'b', 'c'])
    tracker.push_old(['a', 'b', 'c'])
    tracker.done()

    assert added == []
Esempio n. 4
0
def test_streamingdifftracker_basic():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(["a", "b", "c"])
    tracker.push_old(["b"])
    tracker.done()

    assert added == ["a", "c"]
Esempio n. 5
0
def test_streamingdifftracker_more_new():
    added = []

    tracker = StreamingDiffTracker(added.append, 4)
    tracker.push_new(['a', 'b', 'c', 'd'])
    tracker.push_old(['r'])

    tracker.push_new(['e', 'f', 'r', 'z'])
    tracker.push_old([])
    tracker.done()

    assert added == ['a', 'b', 'c', 'd', 'e', 'f', 'z']
Esempio n. 6
0
def test_streamingdifftracker_more_old():
    added = []

    tracker = StreamingDiffTracker(added.append, 2)
    tracker.push_new(['c', 'd'])
    tracker.push_old(['a', 'b'])

    tracker.push_new([])
    tracker.push_old(['c'])
    tracker.done()

    assert added == ['d']
Esempio n. 7
0
def test_streamingdifftracker_empty_old():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(['a', 'b', 'c'])
    tracker.push_old([])

    tracker.push_new(['f', 'g', 'h'])
    tracker.push_old([])
    tracker.done()

    assert added == ['a', 'b', 'c', 'f', 'g', 'h']
Esempio n. 8
0
def test_streamingdifftracker_multiple_calls():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(['a', 'b', 'c'])
    tracker.push_old(['b', 'd', 'e'])

    tracker.push_new(['f', 'g', 'h'])
    tracker.push_old(['g', 'h'])
    tracker.done()

    assert added == ['a', 'c', 'f']
Esempio n. 9
0
def test_streamingdifftracker_more_new():
    added = []

    tracker = StreamingDiffTracker(added.append, 4)
    tracker.push_new(["a", "b", "c", "d"])
    tracker.push_old(["r"])

    tracker.push_new(["e", "f", "r", "z"])
    tracker.push_old([])
    tracker.done()

    assert added == ["a", "b", "c", "d", "e", "f", "z"]
Esempio n. 10
0
def test_streamingdifftracker_more_old():
    added = []

    tracker = StreamingDiffTracker(added.append, 2)
    tracker.push_new(["c", "d"])
    tracker.push_old(["a", "b"])

    tracker.push_new([])
    tracker.push_old(["c"])
    tracker.done()

    assert added == ["d"]
Esempio n. 11
0
def test_streamingdifftracker_empty_old():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(["a", "b", "c"])
    tracker.push_old([])

    tracker.push_new(["f", "g", "h"])
    tracker.push_old([])
    tracker.done()

    assert added == ["a", "b", "c", "f", "g", "h"]
Esempio n. 12
0
def test_streamingdifftracker_multiple_calls():
    added = []

    tracker = StreamingDiffTracker(added.append, 3)
    tracker.push_new(["a", "b", "c"])
    tracker.push_old(["b", "d", "e"])

    tracker.push_new(["f", "g", "h"])
    tracker.push_old(["g", "h"])
    tracker.done()

    assert added == ["a", "c", "f"]