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