Skip to content

Commit

Permalink
sprinkle some coverage on coalesce in core
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud committed Jul 8, 2020
1 parent 85e80dd commit 8d7b59e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions glom/test/test_basic.py
Expand Up @@ -100,6 +100,16 @@ def test_coalesce():
# check that arbitrary exceptions can be ignored
assert glom(val, Coalesce(lambda x: 1/0, 'a.b', skip_exc=ZeroDivisionError)) == 'c'

target = {'a': 1, 'b': 3, 'c': 4}
spec = Coalesce('a', 'b', 'c', skip=lambda x: x % 2)
assert glom(target, spec) == 4

spec = Coalesce('a', 'b', 'c', skip=(1,))
assert glom(target, spec) == 3

with pytest.raises(TypeError):
Coalesce(bad_kwarg=True)



def test_skip():
Expand Down

0 comments on commit 8d7b59e

Please sign in to comment.