<s> """<STR_LIT>""" <EOL> import unittest <EOL> from codejail . safe_exec import json_safe <EOL> class JsonSafeTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> SURROGATE_RANGE = range ( <NUM_LIT> , <NUM_LIT> ) <EOL> def test_unicode ( self ) : <EOL> for unicode_char in [ unichr ( <NUM_LIT> ) , unichr ( <NUM_LIT:2> ** <NUM_LIT:8> - <NUM_LIT:1> ) , unichr ( <NUM_LIT:2> ** <NUM_LIT:16> - <NUM_LIT:1> ) ] : <EOL> result = json_safe ( { '<STR_LIT:test>' : unicode_char } ) <EOL> self . assertEqual ( result . get ( '<STR_LIT:test>' , None ) , unicode_char ) <EOL> result = json_safe ( { unicode_char : '<STR_LIT:test>' } ) <EOL> self . assertEqual ( result . get ( unicode_char , None ) , '<STR_LIT:test>' ) <EOL> def test_surrogate_unicode_values ( self ) : <EOL> for code in self . SURROGATE_RANGE : <EOL> unicode_char = unichr ( code ) <EOL> json_safe ( { '<STR_LIT:test>' : unicode_char } ) <EOL> def test_surrogate_unicode_keys ( self ) : <EOL> for code in self . SURROGATE_RANGE : <EOL> unicode_char = unichr ( code ) <EOL> json_safe ( { unicode_char : '<STR_LIT:test>' } ) </s>
