From f57fb669e9147bc69e2681ce7eeea2ed6294c039 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:20:04 -0700 Subject: [PATCH] Add test coverage for text mode error (#231) * Add test coverage for text mode error Error message was added in https://github.com/hukkin/tomli/pull/175 * review --- tests/test_misc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index 76fa5905..0dad4921 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -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 = """