PATH:
opt
/
bitninja-python-dojo
/
embedded
/
lib
/
python3.9
/
test
/
test_json
import textwrap from test.test_json import PyTest, CTest class TestSeparators: def test_separators(self): h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', {'nifty': 87}, {'field': 'yes', 'morefield': False} ] expect = textwrap.dedent("""\ [ [ "blorpie" ] , [ "whoops" ] , [] , "d-shtaeou" , "d-nthiouh" , "i-vhbjkhnth" , { "nifty" : 87 } , { "field" : "yes" , "morefield" : false } ]""") d1 = self.dumps(h) d2 = self.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : ')) h1 = self.loads(d1) h2 = self.loads(d2) self.assertEqual(h1, h) self.assertEqual(h2, h) self.assertEqual(d2, expect) def test_illegal_separators(self): h = {1: 2, 3: 4} self.assertRaises(TypeError, self.dumps, h, separators=(b', ', ': ')) self.assertRaises(TypeError, self.dumps, h, separators=(', ', b': ')) self.assertRaises(TypeError, self.dumps, h, separators=(b', ', b': ')) class TestPySeparators(TestSeparators, PyTest): pass class TestCSeparators(TestSeparators, CTest): pass
[-] test_separators.py
[edit]
[-] test_speedups.py
[edit]
[-] test_indent.py
[edit]
[-] test_decode.py
[edit]
[-] test_dump.py
[edit]
[+]
..
[-] test_unicode.py
[edit]
[-] test_float.py
[edit]
[-] test_encode_basestring_ascii.py
[edit]
[-] __main__.py
[edit]
[-] test_default.py
[edit]
[-] test_fail.py
[edit]
[-] test_tool.py
[edit]
[-] test_enum.py
[edit]
[+]
__pycache__
[-] test_pass3.py
[edit]
[-] test_pass2.py
[edit]
[-] __init__.py
[edit]
[-] test_scanstring.py
[edit]
[-] test_recursion.py
[edit]
[-] test_pass1.py
[edit]