示例#1
0
def test_merge_random():
    items1 = sorted((random_name(4), random_name(8)) for _ in xrange(500))
    items2 = sorted((random_name(4), random_name(8)) for _ in xrange(500))

    x1 = sorted(dict(items1 + items2).items())
    x2 = list(kv.merge_items(items1, items2))
    assert x1 == x2
示例#2
0
def test_merge_items():
    items1 = [("c", "d"), ("e", "f"), ("g", "h"), ("i", "j"), ("o", "p")]
    items2 = [("_", ":"), ("a", "b"), ("e", None), ("i", "k"), ("m", "n")]

    target = [
        ("_", ":"), ("a", "b"), ("c", "d"), ("g", "h"), ("i", "k"), ("m", "n"),
        ("o", "p")
    ]

    output = list(kv.merge_items(items1, items2))
    assert output == target