예제 #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'"\""'), '"')