mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #10572: Moved json tests to Lib/test/json_tests.
Approved by Raymond Hettinger.
This commit is contained in:
parent
69b34bfe9c
commit
ff27ee0b40
18 changed files with 4 additions and 4 deletions
21
Lib/test/json_tests/test_dump.py
Normal file
21
Lib/test/json_tests/test_dump.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from unittest import TestCase
|
||||
from io import StringIO
|
||||
|
||||
import json
|
||||
|
||||
class TestDump(TestCase):
|
||||
def test_dump(self):
|
||||
sio = StringIO()
|
||||
json.dump({}, sio)
|
||||
self.assertEqual(sio.getvalue(), '{}')
|
||||
|
||||
def test_dumps(self):
|
||||
self.assertEqual(json.dumps({}), '{}')
|
||||
|
||||
def test_encode_truefalse(self):
|
||||
self.assertEqual(json.dumps(
|
||||
{True: False, False: True}, sort_keys=True),
|
||||
'{"false": true, "true": false}')
|
||||
self.assertEqual(json.dumps(
|
||||
{2: 3.0, 4.0: 5, False: 1, 6: True}, sort_keys=True),
|
||||
'{"false": 1, "2": 3.0, "4.0": 5, "6": true}')
|
Loading…
Add table
Add a link
Reference in a new issue