mirror of
https://github.com/python/cpython.git
synced 2025-12-31 20:43:36 +00:00
Some deprecation warnings will reappear (in a slightly different form) in 3.12.
Co-authored-by: Guido van Rossum <guido@python.org>.
(cherry picked from commit 1b2459dc64)
23 lines
605 B
Python
23 lines
605 B
Python
import collections
|
|
from test.test_json import PyTest, CTest
|
|
|
|
|
|
class TestDefault:
|
|
def test_default(self):
|
|
self.assertEqual(
|
|
self.dumps(type, default=repr),
|
|
self.dumps(repr(type)))
|
|
|
|
def test_ordereddict(self):
|
|
od = collections.OrderedDict(a=1, b=2)
|
|
od.move_to_end('a')
|
|
self.assertEqual(
|
|
self.dumps(od),
|
|
'{"b": 2, "a": 1}')
|
|
self.assertEqual(
|
|
self.dumps(od, sort_keys=True),
|
|
'{"a": 1, "b": 2}')
|
|
|
|
|
|
class TestPyDefault(TestDefault, PyTest): pass
|
|
class TestCDefault(TestDefault, CTest): pass
|