File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,22 @@ class TestCanonicalJson(unittest.TestCase):
27
27
def test_encode_canonical (self ):
28
28
self .assertEquals (encode_canonical_json ({}), b'{}' )
29
29
30
+ # non-ascii should come out utf8-encoded.
31
+ self .assertEquals (encode_canonical_json ({
32
+ u"la merde amus\u00c3 e" : u"\U0001F4A9 " ,
33
+ }), b'{"la merde amus\xc3 \x83 e":"\xF0 \x9F \x92 \xA9 "}' )
34
+
30
35
def test_encode_pretty_printed (self ):
31
36
self .assertEquals (encode_pretty_printed_json ({}), b'{}' )
32
37
33
38
def test_frozen_dict (self ):
34
- self .assertEquals (encode_canonical_json (frozendict ({})), b'{}' )
35
- self .assertEquals (encode_pretty_printed_json (frozendict ({})), b'{}' )
39
+ self .assertEquals (
40
+ encode_canonical_json (frozendict ({"a" : 1 })),
41
+ b'{"a":1}' ,
42
+ )
43
+ self .assertEquals (
44
+ encode_pretty_printed_json (frozendict ({"a" : 1 })),
45
+ b'{\n "a": 1\n }' )
36
46
37
47
def test_unknown_type (self ):
38
48
class Unknown (object ):
You can’t perform that action at this time.
0 commit comments