Skip to content

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

Merged
archmoj merged 6 commits into
plotly:masterfrom
marthacryan:extras-tests
Jul 29, 2024
Merged

archmoj merged 6 commits into
plotly:masterfrom
marthacryan:extras-tests

Conversation

@marthacryan

@marthacryan marthacryan commented Jul 26, 2024 •

Copy link
Copy Markdown
Contributor

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).

assert validator_min_max.validate_coerce(val) == approx(val)

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

@archmoj archmoj Jul 26, 2024 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread packages/python/plotly/_plotly_utils/tests/validators/test_integer_validator.py Outdated
@archmoj

archmoj commented Jul 26, 2024

Copy link
Copy Markdown
Contributor

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

Comment thread packages/python/plotly/_plotly_utils/basevalidators.py Outdated
@marthacryan

Copy link
Copy Markdown
Contributor 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

@archmoj archmoj left a comment

Copy link
Copy Markdown
Contributor

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
@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