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