Esempio n. 1
0
def test_merge_dynamic_add():
    merge = translations.Merge((1, 2, 3))
    def adder():
        for val in (1, 2, 3):
            yield val
            merge.add_iterator([4])
    merge.add_iterator(adder())
    assert tuple(merge) == (1, 1, 2, 2, 3, 3, 4, 4, 4)
Esempio n. 2
0
def check_merge(*sequences):
    merged = list(translations.Merge(*sequences))
    concatenated = [val for seq in sequences for val in seq]
    assert merged == sorted(concatenated)