Skip to content

Commit 66c3af1

Browse files
clean up test
1 parent 5d6b2a8 commit 66c3af1

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

Lib/test/test_json/test_dump.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def __lt__(self, o):
6666
self.assertEqual(self.dumps(d, sort_keys=True), '{"1337": "true.dat"}')
6767

6868
def test_mutate_items_during_encode(self):
69-
c_make_encoder = getattr(self.json.encoder, 'c_make_encoder', None)
70-
if c_make_encoder is None:
71-
self.skipTest("c_make_encoder not available")
72-
7369
cache = []
7470

7571
class BadDict(dict):
@@ -84,20 +80,9 @@ def items(self):
8480
def encode_str(obj):
8581
if cache:
8682
cache.pop().clear()
87-
return '"x"'
88-
89-
encoder = c_make_encoder(
90-
None, lambda o: "null",
91-
encode_str, None,
92-
": ", ", ", False,
93-
False, True
94-
)
95-
96-
try:
97-
encoder(BadDict(), 0)
98-
except (ValueError, RuntimeError):
99-
pass
83+
return 'x'
10084

85+
self.assertEqual(self.dumps(BadDict(), default=encode_str), '{"boom": "x"}')
10186

10287
class TestPyDump(TestDump, PyTest): pass
10388

0 commit comments

Comments
 (0)