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_encode_for_html.py
import unittest import simplejson as json class TestEncodeForHTML(unittest.TestCase): def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML() self.non_ascii_encoder = json.JSONEncoderForHTML(ensure_ascii=False) def test_basic_encode(self): self.assertEqual(r'"\u0026"', self.encoder.encode('&')) self.assertEqual(r'"\u003c"', self.encoder.encode('<')) self.assertEqual(r'"\u003e"', self.encoder.encode('>')) self.assertEqual(r'"\u2028"', self.encoder.encode(u'\u2028')) def test_non_ascii_basic_encode(self): self.assertEqual(r'"\u0026"', self.non_ascii_encoder.encode('&')) self.assertEqual(r'"\u003c"', self.non_ascii_encoder.encode('<')) self.assertEqual(r'"\u003e"', self.non_ascii_encoder.encode('>')) self.assertEqual(r'"\u2028"', self.non_ascii_encoder.encode(u'\u2028')) def test_basic_roundtrip(self): for char in '&<>': self.assertEqual( char, self.decoder.decode( self.encoder.encode(char))) def test_prevent_script_breakout(self): bad_string = '</script><script>alert("gotcha")</script>' self.assertEqual( r'"\u003c/script\u003e\u003cscript\u003e' r'alert(\"gotcha\")\u003c/script\u003e"', self.encoder.encode(bad_string)) self.assertEqual( bad_string, self.decoder.decode( self.encoder.encode(bad_string)))
SIMPAN PERUBAHAN