def test_ItemsTraversal_over_empty(): my_lens = b.ItemsTraversal() & b.GetitemLens(0) assert my_lens.over({}, lambda a: a + 1) == {}
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'}
def test_ItemsTraversal_to_list_of_empty(): my_lens = b.ItemsTraversal() assert sorted(my_lens.to_list_of({})) == []
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')]
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"}
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")]