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_subclass.py
from unittest import TestCase import simplejson as json from decimal import Decimal class AlternateInt(int): def __repr__(self): return 'invalid json' __str__ = __repr__ class AlternateFloat(float): def __repr__(self): return 'invalid json' __str__ = __repr__ # class AlternateDecimal(Decimal): # def __repr__(self): # return 'invalid json' class TestSubclass(TestCase): def test_int(self): self.assertEqual(json.dumps(AlternateInt(1)), '1') self.assertEqual(json.dumps(AlternateInt(-1)), '-1') self.assertEqual(json.loads(json.dumps({AlternateInt(1): 1})), {'1': 1}) def test_float(self): self.assertEqual(json.dumps(AlternateFloat(1.0)), '1.0') self.assertEqual(json.dumps(AlternateFloat(-1.0)), '-1.0') self.assertEqual(json.loads(json.dumps({AlternateFloat(1.0): 1})), {'1.0': 1}) # NOTE: Decimal subclasses are not supported as-is # def test_decimal(self): # self.assertEqual(json.dumps(AlternateDecimal('1.0')), '1.0') # self.assertEqual(json.dumps(AlternateDecimal('-1.0')), '-1.0')
SIMPAN PERUBAHAN