X-Git-Url: https://code.kerkeslager.com/?p=ton;a=blobdiff_plain;f=test_don.py;fp=test_don.py;h=0e35e917a4e4e035959c8f5ec5118c9f46193783;hp=cc04df3585279e05923c55c3467526aee1ae9911;hb=84cf65f13614f1ba0ef1b37217a71b46a3b8827a;hpb=a85ba38da87f0d893627ba842fbbd63d7982ecd9 diff --git a/test_don.py b/test_don.py index cc04df3..0e35e91 100644 --- a/test_don.py +++ b/test_don.py @@ -308,6 +308,12 @@ class TestStringDeserialize(unittest.TestCase): string.deserialize("[1i8,2i8,3i8,4i8,5i8]"), ) + def test_deserializes_list_with_leading_whitespace(self): + self.assertEqual( + [1,2,3,4,5], + string.deserialize(" \t\n[ \t\n1i8 \t\n, \t\n2i8 \t\n, \t\n3i8 \t\n, \t\n4i8 \t\n, \t\n5i8 \t\n]"), + ) + def test_deserializes_dictionary(self): self.assertEqual( collections.OrderedDict([ @@ -317,4 +323,13 @@ class TestStringDeserialize(unittest.TestCase): string.deserialize('{"foo"utf8:1i32,"bar"utf8:"baz"utf8}'), ) + def test_deserializes_dictionary_with_leading_whitespace(self): + self.assertEqual( + collections.OrderedDict([ + ('foo', 1), + ('bar', 'baz'), + ]), + string.deserialize(' \t\n{ \t\n"foo"utf8 \t\n: \t\n1i32 \t\n, \t\n"bar"utf8 \t\n: \t\n"baz"utf8 \t\n}'), + ) + unittest.main()