From 662b545d5969bcffe8b158e200616da7f8c41d43 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 20 Feb 2024 15:40:09 +0000 Subject: [PATCH] Added string tests --- tests/test_amulet_nbt/test_tag/test_string.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_amulet_nbt/test_tag/test_string.py b/tests/test_amulet_nbt/test_tag/test_string.py index c368baff..98eea5f4 100644 --- a/tests/test_amulet_nbt/test_tag/test_string.py +++ b/tests/test_amulet_nbt/test_tag/test_string.py @@ -150,6 +150,15 @@ def test_to_nbt(self): ), ) + # Test writing long strings + self.assertEqual( + b"\x08\x00\x00\xff\xff" + b"a"*65535, + StringTag("a"*65535).to_nbt(compressed=False) + ) + + with self.assertRaises(OverflowError): + StringTag("a" * 65536).to_nbt(compressed=False) + def test_from_nbt(self): self.assertEqual( StringTag(),