Repository navigation
Conversation
to_typed_array_spec sends int64 arrays as the smallest integer type that holds both their min and max. No test pinned that a value below the int8 range keeps the array out of int8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue
No linked issue: this PR only adds a test.
Description of change
If the int64 downcast in
to_typed_array_specever checked only the max, an array such asnp.array([-1000, 5])would be squeezed into int8 and wrap, so the chart would plot 24 instead of -1000 with no error, and no test would notice.Tests only: one test (+10 lines, plus
import base64) intests/test_optional/test_graph_objs/test_numpy.py. No change to library code.Demo
Not applicable (no behaviour change).
Testing strategy
The test builds
go.Figure(go.Scatter(y=np.array([-1000, 5], dtype="int64"))), takesto_dict()["data"][0]["y"], decodesbdatawith thedtypeit reports, and checks the values read back as[-1000, 5]. It does not pin which integer type is chosen.On main
52ae6233:python -m pytest tests/test_optional/test_graph_objs/test_numpy.py: 2 passed.ruff formatandruff checkare clean on the file.if max <= int8max:(themin >= int8mincheck dropped), this new test is the only one that fails ([24, 5] == [-1000, 5]);tests/test_core,tests/test_plotly_utils,tests/test_optionalandtests/test_ioshow no other new failure.Additional information (optional)
Tests only, so I did not add a changelog entry; the
no-changeloglabel may be needed.Guidelines
This test was written with Claude Code during a planted-bug run by SK @ Trenyx.