def test__mergesort3(tmpdir): seed(time()) xs = [randint(0, 1000000) for _ in range(1000000)] with tmpdir.join("test.json").open("w") as f: for x in xs: f.write("{0:s}\n".format(dumps(x))) mergesort(tmpdir.join("test.json"), maxitems=10000, progress=False) assert list(jsonstream(tmpdir.join("test.json"))) == sorted(xs)
def test__mergesort2(tmpdir): seed(time()) xs = [sample(range(100), 4) for _ in range(10000)] with tmpdir.join("test.json").open("w") as f: for x in xs: f.write("{0:s}\n".format(dumps(x))) key = itemgetter(0, 1, 2, 3) mergesort(tmpdir.join("test.json"), key=key, maxitems=1000, progress=False) assert list(jsonstream(tmpdir.join("test.json"))) == sorted(xs, key=key)