コード例 #1
0
ファイル: test_LazySequence.py プロジェクト: dhobbs/cljppy
def test_lazy_sequences_are_lazy():
    n = natural_numbers()
    assert take(5, n) == [0, 1, 2, 3, 4]
    assert not n.realised
コード例 #2
0
ファイル: test_LazySequence.py プロジェクト: dhobbs/cljppy
def test_hash_codes_of_lazysequences_make_sense():
    assert hash(LazySequence([0, 1, 2])) == hash(LazySequence(take(3, natural_numbers())))
    assert hash(LazySequence([0, 1, 2, 3])) != hash(LazySequence(take(3, natural_numbers())))