Skip to content

Fix bug in IntegerValidator 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

Conversation

marthacryan
Copy link
Collaborator

@marthacryan marthacryan commented Jul 26, 2024

Follow-up PR to #4612. Adds basic tests for passing and rejecting - also fixes a bug found while testing where the integer validator threw an error when arrays contained both strings and integers.

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the codegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
    - [ ] For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
    - [ ] For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

@@ -56,6 +59,18 @@ def test_rejection_by_value(val, validator):
def test_acceptance_min_max(val, validator_min_max):
assert validator_min_max.validate_coerce(val) == approx(val)

# With extras
@pytest.mark.parametrize("val", ['normal', 'bold'])
Copy link
Contributor

@archmoj archmoj Jul 26, 2024

Choose a reason for hiding this comment

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

Thanks @marthacryan for the PR.
Could you please clarify which of these 3 cases we are testing here?
PR_diff
This is from https://github.com/plotly/plotly.py/pull/4612/files.

BTW I prefer to test all 3 cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@archmoj
Copy link
Contributor

archmoj commented Jul 26, 2024

Please rename the title of the PR to indicate that this is a bug fix.
Also please add a changelog entry.

- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial

@marthacryan
Copy link
Collaborator Author

Please rename the title of the PR to indicate that this is a bug fix. Also please add a changelog entry.

- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial

@archmoj Added! How does it look?

@marthacryan marthacryan changed the title Add tests for IntegerValidator extras Fix bug in IntegerValidator when an array contains both strings and integers, and add tests for IntegerValidator extras Jul 26, 2024
Copy link
Contributor

@archmoj archmoj left a comment

Choose a reason for hiding this comment

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

💃
Excellent.
Please merge it and then delete the branch.
Thank you!

@archmoj archmoj merged commit 5e2d3d8 into plotly:master Jul 29, 2024
4 checks passed
@marthacryan marthacryan deleted the extras-tests branch July 29, 2024 15:49
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