Skip to content

TST: added test for to_json when called on numbers exceeding the int64 limit #47589

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 3 commits into from
Jul 5, 2022
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
17 changes: 17 additions & 0 deletions pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1908,3 +1908,20 @@ def test_complex_data_tojson(self, data, expected):
# GH41174
result = data.to_json()
assert result == expected

@pytest.mark.parametrize(
"data", [{"col1": [13342205958987758245, 12388075603347835679]}]
)
@pytest.mark.parametrize(
"expected",
[
'{"columns":["col1"],"index":[0,1],'
'"data":[[13342205958987758245],[12388075603347835679]]}'
],
)
@pytest.mark.parametrize("orient", ["split"])
def test_json_uint64(self, data, expected, orient):
Copy link
Member

Choose a reason for hiding this comment

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

This is only one test right? You don’t have to paeametrize over arguments that take only one value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh ok. Should I refactor and resubmit?

Copy link
Member

Choose a reason for hiding this comment

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

You can just update this brancj

# GH21073
df = DataFrame(data=data)
result = df.to_json(orient=orient)
assert result == expected