PATH: //opt/cloudlinux/venv/lib/python3.11/site-packages/simplejson/tests
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 __init__.py
↓
X
📁 __pycache__/
X
📄 _cibw_runner.py
↓
X
📄 test_bigint_as_string.py
↓
X
📄 test_bitsize_int_as_string.py
↓
X
📄 test_check_circular.py
↓
X
📄 test_decimal.py
↓
X
📄 test_decode.py
↓
X
📄 test_default.py
↓
X
📄 test_dump.py
↓
X
📄 test_encode_basestring_ascii.py
↓
X
📄 test_encode_for_html.py
↓
X
📄 test_errors.py
↓
X
📄 test_fail.py
↓
X
📄 test_float.py
↓
X
📄 test_for_json.py
↓
X
📄 test_indent.py
↓
X
📄 test_item_sort_key.py
↓
X
📄 test_iterable.py
↓
X
📄 test_namedtuple.py
↓
X
📄 test_pass1.py
↓
X
📄 test_pass2.py
↓
X
📄 test_pass3.py
↓
X
📄 test_raw_json.py
↓
X
📄 test_recursion.py
↓
X
📄 test_scanstring.py
↓
X
📄 test_separators.py
↓
X
📄 test_speedups.py
↓
X
📄 test_str_subclass.py
↓
X
📄 test_subclass.py
↓
X
📄 test_tool.py
↓
X
📄 test_tuple.py
↓
X
📄 test_unicode.py
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: test_recursion.py
from unittest import TestCase import simplejson as json class JSONTestObject: pass class RecursiveJSONEncoder(json.JSONEncoder): recurse = False def default(self, o): if o is JSONTestObject: if self.recurse: return [JSONTestObject] else: return 'JSONTestObject' return json.JSONEncoder.default(o) class TestRecursion(TestCase): def test_listrecursion(self): x = [] x.append(x) try: json.dumps(x) except ValueError: pass else: self.fail("didn't raise ValueError on list recursion") x = [] y = [x] x.append(y) try: json.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 json.dumps(x) def test_dictrecursion(self): x = {} x["test"] = x try: json.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 json.dumps(y) def test_defaultrecursion(self): 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")
SIMPAN PERUBAHAN