aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_library.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-28 10:44:16 +0100
committerDanilo M. <danix@danix.xyz>2026-10-28 10:44:16 +0100
commit0838881b87f3a59ccd841d247e4b975347529220 (patch)
treede0684bcf35e91c75ed5c615f88bc639fe4e2e44 /tests/test_library.py
parentd368de4b30d8a1dc9bb72ba45c55b07d3f034c82 (diff)
downloadgenerat3D-0838881b87f3a59ccd841d247e4b975347529220.tar.gz
generat3D-0838881b87f3a59ccd841d247e4b975347529220.zip
Turn remaining malformed-input crashes into Error
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_library.py')
-rw-r--r--tests/test_library.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_library.py b/tests/test_library.py
index 84fa3cc..7e06ca4 100644
--- a/tests/test_library.py
+++ b/tests/test_library.py
@@ -89,3 +89,19 @@ class LibraryTest(unittest.TestCase):
p = Path(self.tmp.name) / "x.duf"
p.write_text(json.dumps({"x": 1}))
self.assertEqual(read_dson(p), {"x": 1})
+
+
+class ReadDsonCrashTest(unittest.TestCase):
+ def read(self, data):
+ with tempfile.TemporaryDirectory() as d:
+ p = Path(d) / "x.dsf"
+ p.write_bytes(data)
+ read_dson(p)
+
+ def test_corrupt_gzip_is_error(self):
+ with self.assertRaises(Error):
+ self.read(b"\x1f\x8b\x08\x00" + b"\xff" * 20)
+
+ def test_deep_nesting_is_error(self):
+ with self.assertRaises(Error):
+ self.read(b"[" * 200000)