예제 #1
0
def test_collection_apply(coll):
    vals = coll([1, 2])
    assert map_collection(lambda x: x + 2, vals) == coll([3, 4])
예제 #2
0
def test_collection_apply_to_mapping():
    vals = {'a': 1, 'b': 2}
    assert map_collection(lambda x: x + 2, vals) == {'a': 3, 'b': 4}
예제 #3
0
def test_map_collection_on_non_collection(non_collection):
    assert map_collection(lambda x: x + 2, non_collection) == non_collection