Skip to content

Conversation

@eskuat
Copy link

@eskuat eskuat commented Oct 30, 2023

Fix for Issue #55

Comment on lines +184 to +190
def test_null_none(session):
"""
Make sure library can handle both None and null() as JSON value
"""
for value in (None, null()):
author = Author(name="John Doe", handles=value)
Article(author=author.name, content="very important", references=value)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the test fail when either of these fail, parametrize over the different null-like values:

Suggested change
def test_null_none(session):
"""
Make sure library can handle both None and null() as JSON value
"""
for value in (None, null()):
author = Author(name="John Doe", handles=value)
Article(author=author.name, content="very important", references=value)
@pytest.mark.parametrize("null_like", [None, null()])
def test_null_like_assignments(null_like):
"""Make sure library can handle both None and null() as JSON value."""
author = Author(name="John Doe", handles=null_like)
assert author.handles is None

@edelooff
Copy link
Owner

Apologies for the delay. The change looks good but the testing needs a small change to separate the two actual tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants