Skip to content

Commit

Permalink
separate List, Set and Dict check for In and NotIn (#132)
Browse files Browse the repository at this point in the history
* separate List, Set and Dict check
  • Loading branch information
loechel authored Oct 2, 2018
1 parent cf8947b commit fd4ddad
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions tests/transformer/test_comparators.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,36 @@ def test_RestrictingNodeTransformer__visit_IsNot__1(e_eval):


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_In__1(e_eval):
"""It allows `in` expressions."""
def test_RestrictingNodeTransformer__visit_In_List(e_eval):
"""It allows `in` expressions for lists."""
assert e_eval('2 in [1, 2, 3]') is True


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_NotIn__1(e_eval):
"""It allows `in` expressions."""
def test_RestrictingNodeTransformer__visit_NotIn_List(e_eval):
"""It allows `not in` expressions for lists."""
assert e_eval('2 not in [1, 2, 3]') is False


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_In_Set(e_eval):
"""It allows `in` expressions for sets."""
assert e_eval('2 in {1, 1, 2, 3}') is True


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_NotIn_Set(e_eval):
"""It allows `not in` expressions for sets."""
assert e_eval('2 not in {1, 2, 3}') is False


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_In_Dict(e_eval):
"""It allows `in` expressions for dicts."""
assert e_eval('2 in {1: 1, 2: 2, 3: 3}') is True


@pytest.mark.parametrize(*e_eval)
def test_RestrictingNodeTransformer__visit_NotIn_Dict(e_eval):
"""It allows `not in` expressions for dicts."""
assert e_eval('2 not in {1: 1, 2: 2, 3: 3}') is False

0 comments on commit fd4ddad

Please sign in to comment.