Skip to content
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

TST: Added tests to check if file exists for read_json. #44911

Closed
wants to merge 1 commit into from

Conversation

cheungje
Copy link

@cheungje cheungje commented Dec 15, 2021

#29102 already added code to fix the original issue of fixing misleading error messages when trying to open a nonexistent json file. This commit adds test cases.

@@ -265,7 +266,8 @@ def test_write_missing_parent_directory(self, method, module, error_class, fn_ex
(pd.read_hdf, "tables", FileNotFoundError, "h5"),
(pd.read_stata, "os", FileNotFoundError, "dta"),
(pd.read_sas, "os", FileNotFoundError, "sas7bdat"),
(pd.read_json, "os", ValueError, "json"),
# (pd.read_json, "os", ValueError, "json"),
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove this?

Which message is actually shown?

Copy link
Author

Choose a reason for hiding this comment

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

I removed this because the comments in #29102 asks to create test cases such that the errors returned by read_json returns a FileNotFoundError instead of a ValueError.

Copy link
Member

Choose a reason for hiding this comment

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

You have to change the actual implementation to raise the correct error

@jreback jreback added IO JSON read_json, to_json, json_normalize Testing pandas testing functions or related to the test suite labels Jan 16, 2022
@jreback
Copy link
Contributor

jreback commented Jan 16, 2022

@cheungje if you'd merge master and address comments

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Feb 16, 2022
@jreback
Copy link
Contributor

jreback commented Feb 16, 2022

closing as stale

@jreback jreback closed this Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize Stale Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading error messages when opening inexistent json file
4 participants