diff options
| author | kapitche <kapitche@users.noreply.github.com> | 2026-11-22 15:19:44 -0500 |
|---|---|---|
| committer | kapitche <kapitche@users.noreply.github.com> | 2026-11-22 15:19:44 -0500 |
| commit | 6b1b479aa2fe7e5f216a98fbb377d1cd6fdc0f04 (patch) | |
| tree | c10cdc51ae9381fd009ffb21749195640a32e80a /tests/test_rbf0_encode.py | |
| parent | f847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff) | |
rbf0_encode: a non-UTF-8 report is a one-line error, not a UnicodeDecodeError traceback
Diffstat (limited to 'tests/test_rbf0_encode.py')
| -rw-r--r-- | tests/test_rbf0_encode.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_rbf0_encode.py b/tests/test_rbf0_encode.py index 482af7c36..bbf18ea3a 100644 --- a/tests/test_rbf0_encode.py +++ b/tests/test_rbf0_encode.py | |||
| @@ -272,6 +272,16 @@ class Cli(unittest.TestCase): | |||
| 272 | self.run_main(report, out_dir) | 272 | self.run_main(report, out_dir) |
| 273 | self.assertFalse(os.path.exists(out_dir)) | 273 | self.assertFalse(os.path.exists(out_dir)) |
| 274 | 274 | ||
| 275 | def test_non_utf8_report_is_one_line_error(self): | ||
| 276 | report = os.path.join(self.tmp.name, "binary.json") | ||
| 277 | with open(report, "wb") as f: | ||
| 278 | f.write(b"\xff\xfe{\x80") | ||
| 279 | out_dir = os.path.join(self.tmp.name, "out-binary") | ||
| 280 | with self.assertRaises(SystemExit) as cm: | ||
| 281 | self.run_main(report, out_dir) | ||
| 282 | self.assertIn("cannot read report", str(cm.exception)) | ||
| 283 | self.assertFalse(os.path.exists(out_dir)) | ||
| 284 | |||
| 275 | def test_write_all_handles_non_int_offset_and_non_dict_resource(self): | 285 | def test_write_all_handles_non_int_offset_and_non_dict_resource(self): |
| 276 | doc = rbf0_tree.parse_resource(every_record(True)) | 286 | doc = rbf0_tree.parse_resource(every_record(True)) |
| 277 | doc["offset"] = "0x100" | 287 | doc["offset"] = "0x100" |