示例#1
0
 def test_quoted_string_allow_escaped_double_quotes(self):
     self.assertEquals(decode(r'"\""'), '"')
示例#2
0
 def test_quoted_string_high_unicode(self):
     self.assertEquals(decode('"\U0001f4a9"'), '\U0001f4a9')
示例#3
0
 def test_quoted_string_left_quotes(self):
     self.assertEquals(decode('" y \N{LEFT DOUBLE QUOTATION MARK}'), ' y ')
示例#4
0
 def test_natural_number(self):
     self.assertEquals(decode('42'), Decimal('42'))
示例#5
0
 def test_plenty_of_precision(self):
     self.assertEquals(unicode(decode('6.' + '0' * 100 + '42')),
                       '6.' + '0' * 100 + '42')
示例#6
0
 def test_false(self):
     self.assertEquals(decode('\N{NO-BREAK SPACE} false'), False)
示例#7
0
 def test_null_is_case_sensitive(self):
     self.assertEquals(decode('Null'), 'Null')
示例#8
0
 def test_empty_object(self):
     self.assertEquals(decode(' {} '), {})
示例#9
0
 def test_empty_list(self):
     self.assertEquals(decode(' []\n'), [])
示例#10
0
 def test_true(self):
     self.assertEquals(decode('true '), True)
示例#11
0
 def test_false(self):
     self.assertEquals(decode('\N{NO-BREAK SPACE} false'), False)
示例#12
0
 def test_null(self):
     self.assertEquals(decode(' null\n'), None)
示例#13
0
 def test_quoted_string_with_escaped_embedded_whitespace_newlines(self):
     self.assertEquals(decode('"hello\\ \r\n\nworld"'), 'hello\nworld')
示例#14
0
 def test_quoted_string_with_escaped_embedded_newline(self):
     self.assertEquals(decode('"hello\\\nworld"'), 'helloworld')
示例#15
0
 def test_quoted_string_with_escaped_embedded_newline(self):
     self.assertEquals(decode('"hello\\\nworld"'), 'helloworld')
示例#16
0
 def test_empty_list_cant_have_space_inside(self):
     self.assertEquals(decode(' [ ]'), '[ ]')
示例#17
0
 def test_null(self):
     self.assertEquals(decode(' null\n'), None)
示例#18
0
 def test_null_is_case_sensitive(self):
     self.assertEquals(decode('Null'), 'Null')
示例#19
0
 def test_empty_list(self):
     self.assertEquals(decode(' []\n'), [])
示例#20
0
 def test_true_is_case_sensitive(self):
     self.assertEquals(decode('TRUE'), 'TRUE')
示例#21
0
 def test_false_is_case_sensitive(self):
     self.assertEquals(decode('falsE'), 'falsE')
示例#22
0
 def test_false_is_case_sensitive(self):
     self.assertEquals(decode('falsE'), 'falsE')
示例#23
0
 def test_decimal_number(self):
     self.assertEquals(decode('0.0009'), Decimal('0.0009'))
示例#24
0
 def test_empty_object_no_internal_whitespace_allowed(self):
     self.assertEquals(decode(' { } '), '{ }')
示例#25
0
 def test_string_unicode(self):
     self.assertEquals(decode('\N{SNOWMAN}'), '\N{SNOWMAN}')
示例#26
0
 def test_natural_number(self):
     self.assertEquals(decode('42'), Decimal('42'))
示例#27
0
 def test_quoted_string_significant_whitespace(self):
     self.assertEquals(decode('"  hello "'), '  hello ')
示例#28
0
 def test_negative_integer(self):
     self.assertEquals(decode('-9'), Decimal('-9'))
示例#29
0
 def test_quoted_string_auto_escape_double_quotes_leading_backslash(self):
     self.assertEquals(decode(r'"\\""'), r'\"')
示例#30
0
 def test_decimal_number(self):
     self.assertEquals(decode('0.0009'), Decimal('0.0009'))
示例#31
0
 def test_quoted_string_auto_escape_double_quotes_leading_backslash(self):
     self.assertEquals(decode(r'"\\""'), r'\"')
示例#32
0
 def test_exponent_number(self):
     self.assertEquals(decode('-1.96e-20'), Decimal('-1.96e-20'))
示例#33
0
 def test_quoted_string_with_escaped_embedded_whitespace_newlines(self):
     self.assertEquals(decode('"hello\\ \r\n\nworld"'), 'hello\nworld')
示例#34
0
 def test_plenty_of_precision(self):
     self.assertEquals(unicode(decode('6.' + '0' * 100 + '42')),
         '6.' + '0' * 100 + '42')
示例#35
0
 def test_true(self):
     self.assertEquals(decode('true '), True)
示例#36
0
 def test_string_single_quote(self):
     self.assertEquals(decode('"'), '"')
示例#37
0
 def test_empty_object(self):
     self.assertEquals(decode(' {} '), {})
示例#38
0
 def test_string_unicode(self):
     self.assertEquals(decode('\N{SNOWMAN}'), '\N{SNOWMAN}')
示例#39
0
 def test_empty_list_cant_have_space_inside(self):
     self.assertEquals(decode(' [ ]'), '[ ]')
示例#40
0
 def test_quoted_string_unicode(self):
     self.assertEquals(decode('"\N{SNOWMAN}"'), '\N{SNOWMAN}')
示例#41
0
 def test_true_is_case_sensitive(self):
     self.assertEquals(decode('TRUE'), 'TRUE')
示例#42
0
 def test_quoted_string_high_unicode(self):
     self.assertEquals(decode('"\U0001f4a9"'), '\U0001f4a9')
示例#43
0
 def test_empty_object_no_internal_whitespace_allowed(self):
     self.assertEquals(decode(' { } '), '{ }')
示例#44
0
 def test_quoted_string_escaped_surrogate_pairs(self):
     self.assertEquals(decode(r'"\ud83d\udca9"'), '\U0001f4a9')
示例#45
0
 def test_negative_integer(self):
     self.assertEquals(decode('-9'), Decimal('-9'))
示例#46
0
 def test_quoted_string_significant_whitespace(self):
     self.assertEquals(decode('"  hello "'), '  hello ')
示例#47
0
 def test_exponent_number(self):
     self.assertEquals(decode('-1.96e-20'), Decimal('-1.96e-20'))
示例#48
0
 def test_quoted_string_right_quotes(self):
     self.assertEquals(decode('\N{RIGHT DOUBLE QUOTATION MARK} o "'), ' o ')
示例#49
0
 def test_string_single_quote(self):
     self.assertEquals(decode('"'), '"')
示例#50
0
 def test_quoted_string_left_quotes(self):
     self.assertEquals(decode('" y \N{LEFT DOUBLE QUOTATION MARK}'), ' y ')
示例#51
0
 def test_quoted_string_unicode(self):
     self.assertEquals(decode('"\N{SNOWMAN}"'), '\N{SNOWMAN}')
示例#52
0
 def test_quoted_string_auto_escape_double_quotes(self):
     self.assertEquals(decode('"""'),'"')
示例#53
0
 def test_quoted_string_escaped_surrogate_pairs(self):
     self.assertEquals(decode(r'"\ud83d\udca9"'), '\U0001f4a9')
示例#54
0
 def test_quoted_string_escaped_backslash(self):
     self.assertEquals(decode(r'"\\"'), '\\')
示例#55
0
 def test_quoted_string_right_quotes(self):
     self.assertEquals(decode('\N{RIGHT DOUBLE QUOTATION MARK} o "'), ' o ')
示例#56
0
 def test_quoted_string_escaped_backslash(self):
     self.assertEquals(decode(r'"\\"'), '\\')
示例#57
0
 def test_quoted_string_auto_escape_double_quotes(self):
     self.assertEquals(decode('"""'), '"')
示例#58
0
 def test_quoted_string_allow_escaped_double_quotes(self):
     self.assertEquals(decode(r'"\""'), '"')