Пример #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']
Пример #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"]
Пример #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 == []
Пример #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"]
Пример #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']
Пример #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']
Пример #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']
Пример #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']
Пример #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"]
Пример #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"]
Пример #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"]
Пример #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"]