10000 Fix bug in IntegerValidator when an array contains both strings and integers, and add tests for IntegerValidator extras by marthacryan · Pull Request #4693 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

Fix bug in IntegerValida 8000 tor when an array contains both strings and integers, and add tests for IntegerValidator extras #4693

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

Merged
merged 6 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove mention of italics
  • Loading branch information
marthacryan committed Jul 26, 2024
commit 9986b2d6b6a5586b4ae4b15eea8216a2521b8cd6
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def validator_extras():

@pytest.fixture
def validator_extras_aok():
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True, extras=['normal', 'bold', 'italics'])
return IntegerValidator("prop", "parent", min=-2, max=10, array_ok=True, extras=['normal', 'bold'])

# ### Acceptance ###
@pytest.mark.parametrize("val", [1, -19, 0, -1234])
Expand Down Expand Up @@ -69,12 +69,12 @@ def test_acceptance_extras(val, validator_extras):
assert validator_extras.validate_coerce(val) == val

# Test extras for array_ok
@pytest.mark.parametrize("val", [[10, 'normal', 'bold'], ['italics'], [10, -2], [5]])
@pytest.mark.parametrize("val", [[10, 'normal', 'bold'], ['normal'], [10, -2], [5]])
def test_acceptance_extras_array(val, validator_extras_aok):
assert validator_extras_aok.validate_coerce(val) == val

# Test rejection by extras
@pytest.mark.parametrize("val", ['italic', 'bolditalic', -3, 11])
@pytest.mark.parametrize("val", ['invalid value', 'different invalid value', -3, 11])
def test_rejection_extras(val, validator_extras):
with pytest.raises(ValueError) as validation_failure:
validator_extras.validate_coerce(val)
Expand Down
0