Add test for parse_json_file and change typing to os.PathLike (#30183)

* Add test for parse_json_file

* Change Path to PathLike

* Fix `Import block is un-sorted or un-formatted`

* revert parse_json_file

* Fix ruff format

* Add parse_json_file test
This commit is contained in:
Xu Song
2024-04-15 16:34:36 +08:00
committed by GitHub
parent b109257f4f
commit 8fd2de933c
2 changed files with 8 additions and 3 deletions

View File

@@ -379,7 +379,7 @@ class HfArgumentParserTest(unittest.TestCase):
os.mkdir(temp_local_path)
with open(temp_local_path + ".json", "w+") as f:
json.dump(args_dict_for_json, f)
parsed_args = parser.parse_yaml_file(Path(temp_local_path + ".json"))[0]
parsed_args = parser.parse_json_file(Path(temp_local_path + ".json"))[0]
args = BasicExample(**args_dict_for_json)
self.assertEqual(parsed_args, args)