Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate List, Set and Dict check for In and NotIn #132

Merged
merged 3 commits into from
Oct 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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