Skip to content

Commit 0e6fbfe

Browse files
committed
Fix HfArgumentParserTest::test_valid_dict_annotation checks
Signed-off-by: cyy <[email protected]>
1 parent 0d46353 commit 0e6fbfe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/utils/test_hf_argparser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,13 @@ def test_valid_dict_annotation(self):
455455
args = get_args(field.type)
456456
# These should be returned as `dict`, `str`, ...
457457
# we only care about the first two
458-
self.assertIn(args[0], (dict, dict))
459-
self.assertEqual(
460-
str(args[1]),
458+
self.assertIn(dict, args)
459+
self.assertIn(
460+
str,
461+
args,
461462
"<class 'str'>",
462463
f"Expected field `{field.name}` to have a type signature of at least `typing.Union[dict,str,...]` for CLI compatibility, "
463-
"but `str` not found. Please fix this.",
464+
f"but `str` not found. Its type is {args}, Please fix this.",
464465
)
465466

466467
# Second check: anything in `optional_dict_fields` is bad if it's not in `base_list`

0 commit comments

Comments
 (0)