Beispiel #1
0
def test_ItemsTraversal_over_empty():
    my_lens = b.ItemsTraversal() & b.GetitemLens(0)
    assert my_lens.over({}, lambda a: a + 1) == {}
Beispiel #2
0
def test_ItemsTraversal_over():
    data = {0: 'zero', 1: 'one'}
    my_lens = b.ItemsTraversal() & b.GetitemLens(0)
    assert my_lens.over(data, lambda a: a + 1) == {1: 'zero', 2: 'one'}
Beispiel #3
0
def test_ItemsTraversal_to_list_of_empty():
    my_lens = b.ItemsTraversal()
    assert sorted(my_lens.to_list_of({})) == []
Beispiel #4
0
def test_ItemsTraversal_to_list_of():
    data = {0: 'zero', 1: 'one'}
    my_lens = b.ItemsTraversal()
    assert sorted(my_lens.to_list_of(data)) == [(0, 'zero'), (1, 'one')]
Beispiel #5
0
def test_ItemsTraversal_over():
    data = {0: "zero", 1: "one"}
    my_lens = b.ItemsTraversal() & b.GetitemLens(0)
    assert my_lens.over(data, lambda a: a + 1) == {1: "zero", 2: "one"}
Beispiel #6
0
def test_ItemsTraversal_to_list_of():
    data = {0: "zero", 1: "one"}
    my_lens = b.ItemsTraversal()
    assert sorted(my_lens.to_list_of(data)) == [(0, "zero"), (1, "one")]