File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
1313 retval = 0
1414 for filename in args .filenames :
1515 try :
16- with open (filename ) as f :
17- toml .load (f )
16+ toml .load (filename )
1817 except toml .TomlDecodeError as exc :
1918 print (f'{ filename } : { exc } ' )
2019 retval = 1
Original file line number Diff line number Diff line change 11from pre_commit_hooks .check_toml import main
22
33
4- def test_toml_good (tmpdir ):
4+ def test_toml_bad (tmpdir ):
55 filename = tmpdir .join ('f' )
66 filename .write ("""
77key = # INVALID
@@ -12,7 +12,7 @@ def test_toml_good(tmpdir):
1212 assert ret == 1
1313
1414
15- def test_toml_bad (tmpdir ):
15+ def test_toml_good (tmpdir ):
1616 filename = tmpdir .join ('f' )
1717 filename .write (
1818 """
@@ -27,3 +27,10 @@ def test_toml_bad(tmpdir):
2727 )
2828 ret = main ((filename .strpath ,))
2929 assert ret == 0
30+
31+
32+ def test_toml_good_unicode (tmpdir ):
33+ filename = tmpdir .join ('f' )
34+ filename .write_binary ('letter = "\N{SNOWMAN} "\n ' .encode ())
35+ ret = main ((filename .strpath ,))
36+ assert ret == 0
You can’t perform that action at this time.
0 commit comments