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

Added null() support #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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