Hackfut Security File Manager
Current Path:
/opt/alt/python27/lib64/python2.7/site-packages/simplejson/tests
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
simplejson
/
tests
/
📁
..
📄
__init__.py
(2.03 KB)
📄
__init__.pyc
(2.96 KB)
📄
__init__.pyo
(2.96 KB)
📄
test_check_circular.py
(917 B)
📄
test_check_circular.pyc
(2.21 KB)
📄
test_check_circular.pyo
(2.21 KB)
📄
test_decimal.py
(1.91 KB)
📄
test_decimal.pyc
(2.87 KB)
📄
test_decimal.pyo
(2.87 KB)
📄
test_decode.py
(3.21 KB)
📄
test_decode.pyc
(5.22 KB)
📄
test_decode.pyo
(5.22 KB)
📄
test_default.py
(222 B)
📄
test_default.pyc
(791 B)
📄
test_default.pyo
(791 B)
📄
test_dump.py
(984 B)
📄
test_dump.pyc
(2.04 KB)
📄
test_dump.pyo
(2.04 KB)
📄
test_encode_basestring_ascii.py
(2.25 KB)
📄
test_encode_basestring_ascii.pyc
(3.58 KB)
📄
test_encode_basestring_ascii.pyo
(3.58 KB)
📄
test_encode_for_html.py
(1.05 KB)
📄
test_encode_for_html.pyc
(1.95 KB)
📄
test_encode_for_html.pyo
(1.95 KB)
📄
test_errors.py
(1 KB)
📄
test_errors.pyc
(1.85 KB)
📄
test_errors.pyo
(1.85 KB)
📄
test_fail.py
(3.47 KB)
📄
test_fail.pyc
(2.64 KB)
📄
test_fail.pyo
(2.64 KB)
📄
test_float.py
(743 B)
📄
test_float.pyc
(1.38 KB)
📄
test_float.pyo
(1.38 KB)
📄
test_indent.py
(2.51 KB)
📄
test_indent.pyc
(2.98 KB)
📄
test_indent.pyo
(2.98 KB)
📄
test_namedtuple.py
(2.47 KB)
📄
test_namedtuple.pyc
(3.39 KB)
📄
test_namedtuple.pyo
(3.39 KB)
📄
test_pass1.py
(1.86 KB)
📄
test_pass1.pyc
(2.31 KB)
📄
test_pass1.pyo
(2.31 KB)
📄
test_pass2.py
(387 B)
📄
test_pass2.pyc
(867 B)
📄
test_pass2.pyo
(867 B)
📄
test_pass3.py
(483 B)
📄
test_pass3.pyc
(962 B)
📄
test_pass3.pyo
(962 B)
📄
test_recursion.py
(1.64 KB)
📄
test_recursion.pyc
(2.64 KB)
📄
test_recursion.pyo
(2.64 KB)
📄
test_scanstring.py
(3.96 KB)
📄
test_scanstring.pyc
(4.71 KB)
📄
test_scanstring.pyo
(4.71 KB)
📄
test_separators.py
(945 B)
📄
test_separators.pyc
(1.56 KB)
📄
test_separators.pyo
(1.56 KB)
📄
test_speedups.py
(592 B)
📄
test_speedups.pyc
(1.34 KB)
📄
test_speedups.pyo
(1.34 KB)
📄
test_tuple.py
(1.8 KB)
📄
test_tuple.pyc
(2.21 KB)
📄
test_tuple.pyo
(2.21 KB)
📄
test_unicode.py
(4.58 KB)
📄
test_unicode.pyc
(6.57 KB)
📄
test_unicode.pyo
(6.57 KB)
Editing: test_tuple.py
import unittest from StringIO import StringIO import simplejson as json class TestTuples(unittest.TestCase): def test_tuple_array_dumps(self): t = (1, 2, 3) expect = json.dumps(list(t)) # Default is True self.assertEqual(expect, json.dumps(t)) self.assertEqual(expect, json.dumps(t, tuple_as_array=True)) self.assertRaises(TypeError, json.dumps, t, tuple_as_array=False) # Ensure that the "default" does not get called self.assertEqual(expect, json.dumps(t, default=repr)) self.assertEqual(expect, json.dumps(t, tuple_as_array=True, default=repr)) # Ensure that the "default" gets called self.assertEqual( json.dumps(repr(t)), json.dumps(t, tuple_as_array=False, default=repr)) def test_tuple_array_dump(self): t = (1, 2, 3) expect = json.dumps(list(t)) # Default is True sio = StringIO() json.dump(t, sio) self.assertEqual(expect, sio.getvalue()) sio = StringIO() json.dump(t, sio, tuple_as_array=True) self.assertEqual(expect, sio.getvalue()) self.assertRaises(TypeError, json.dump, t, StringIO(), tuple_as_array=False) # Ensure that the "default" does not get called sio = StringIO() json.dump(t, sio, default=repr) self.assertEqual(expect, sio.getvalue()) sio = StringIO() json.dump(t, sio, tuple_as_array=True, default=repr) self.assertEqual(expect, sio.getvalue()) # Ensure that the "default" gets called sio = StringIO() json.dump(t, sio, tuple_as_array=False, default=repr) self.assertEqual( json.dumps(repr(t)), sio.getvalue()) class TestNamedTuple(unittest.TestCase): def test_namedtuple_dump(self): pass
Upload File
Create Folder