Skip to content

Commit

Permalink
Add test coverage for text mode error (#231)
Browse files Browse the repository at this point in the history
* Add test coverage for text mode error

Error message was added in #175

* review
  • Loading branch information
hauntsaninja authored Oct 8, 2024
1 parent 4be816b commit f57fb66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def test_incorrect_load(self):
file_path.write_text(content)

with open(file_path, "r") as txt_f:
with self.assertRaises(TypeError):
with self.assertRaises(TypeError) as exc_info:
tomllib.load(txt_f) # type: ignore[arg-type]
self.assertEqual(
str(exc_info.exception),
"File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`",
)

def test_parse_float(self):
doc = """
Expand Down

0 comments on commit f57fb66

Please sign in to comment.