✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server.blackpussy.asia ​🇻​♯➤ 5.14.0-611.20.1.el9_7.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 163.245.207.76 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.243
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗞 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ mail,mb_send_mail
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/imunify360/venv/lib/python3.11/site-packages/simplejson/tests//test_iterable.py
import unittest
from simplejson.compat import StringIO

import simplejson as json

def iter_dumps(obj, **kw):
    return ''.join(json.JSONEncoder(**kw).iterencode(obj))

def sio_dump(obj, **kw):
    sio = StringIO()
    json.dumps(obj, **kw)
    return sio.getvalue()

class BadIter:
    """Object whose __iter__ raises a non-TypeError exception."""
    def __init__(self, exc_type):
        self.exc_type = exc_type
    def __iter__(self):
        raise self.exc_type("from __iter__")


class TestIterable(unittest.TestCase):
    def test_iterable(self):
        for l in ([], [1], [1, 2], [1, 2, 3]):
            for opts in [{}, {'indent': 2}]:
                for dumps in (json.dumps, iter_dumps, sio_dump):
                    expect = dumps(l, **opts)
                    default_expect = dumps(sum(l), **opts)
                    # Default is False
                    self.assertRaises(TypeError, dumps, iter(l), **opts)
                    self.assertRaises(TypeError, dumps, iter(l), iterable_as_array=False, **opts)
                    self.assertEqual(expect, dumps(iter(l), iterable_as_array=True, **opts))
                    # Ensure that the "default" gets called
                    self.assertEqual(default_expect, dumps(iter(l), default=sum, **opts))
                    self.assertEqual(default_expect, dumps(iter(l), iterable_as_array=False, default=sum, **opts))
                    # Ensure that the "default" does not get called
                    self.assertEqual(
                        expect,
                        dumps(iter(l), iterable_as_array=True, default=sum, **opts))

    def test_iterable_as_array_propagates_non_typeerror(self):
        # Regression test: MemoryError from __iter__ must not be
        # swallowed by PyErr_Clear and replaced with TypeError.
        # Test against the C encoder directly since json.dumps may
        # use the Python fallback encoder.
        try:
            import simplejson._speedups as sp
            import decimal
        except ImportError:
            return  # C extension not available
        def noop_default(obj):
            raise TypeError('not serializable')
        c_enc = sp.make_encoder(
            {}, noop_default, sp.encode_basestring_ascii, None,
            ', ', ': ', False, False, True, {}, False, False,
            False, None, None, 'utf-8', False, False,
            decimal.Decimal, True,  # iterable_as_array=True
        )
        for exc_type in (MemoryError, RuntimeError):
            with self.assertRaises(exc_type):
                c_enc(BadIter(exc_type), 0)

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
13 Aug 2026 4.57 AM
root / root
0755
__pycache__
--
13 Aug 2026 4.57 AM
root / root
0755
__init__.py
2.849 KB
20 Jul 2026 8.43 AM
root / root
0644
_cibw_runner.py
0.169 KB
20 Jul 2026 8.43 AM
root / root
0644
_helpers.py
0.396 KB
20 Jul 2026 8.43 AM
root / root
0644
test_bigint_as_string.py
2.186 KB
20 Jul 2026 8.43 AM
root / root
0644
test_bitsize_int_as_string.py
4.429 KB
20 Jul 2026 8.43 AM
root / root
0644
test_check_circular.py
1.542 KB
20 Jul 2026 8.43 AM
root / root
0644
test_decimal.py
2.484 KB
20 Jul 2026 8.43 AM
root / root
0644
test_decode.py
7.295 KB
20 Jul 2026 8.43 AM
root / root
0644
test_default.py
0.216 KB
20 Jul 2026 8.43 AM
root / root
0644
test_dump.py
17.188 KB
20 Jul 2026 8.43 AM
root / root
0644
test_encode_basestring_ascii.py
2.282 KB
20 Jul 2026 8.43 AM
root / root
0644
test_encode_for_html.py
1.479 KB
20 Jul 2026 8.43 AM
root / root
0644
test_errors.py
3.421 KB
20 Jul 2026 8.43 AM
root / root
0644
test_fail.py
6.303 KB
20 Jul 2026 8.43 AM
root / root
0644
test_float.py
1.937 KB
20 Jul 2026 8.43 AM
root / root
0644
test_for_json.py
4.029 KB
20 Jul 2026 8.43 AM
root / root
0644
test_free_threading.py
3.095 KB
20 Jul 2026 8.43 AM
root / root
0644
test_indent.py
2.508 KB
20 Jul 2026 8.43 AM
root / root
0644
test_item_sort_key.py
1.344 KB
20 Jul 2026 8.43 AM
root / root
0644
test_iterable.py
2.52 KB
20 Jul 2026 8.43 AM
root / root
0644
test_namedtuple.py
7.218 KB
20 Jul 2026 8.43 AM
root / root
0644
test_pass1.py
1.705 KB
20 Jul 2026 8.43 AM
root / root
0644
test_pass2.py
0.377 KB
20 Jul 2026 8.43 AM
root / root
0644
test_pass3.py
0.471 KB
20 Jul 2026 8.43 AM
root / root
0644
test_raw_json.py
1.037 KB
20 Jul 2026 8.43 AM
root / root
0644
test_recursion.py
1.64 KB
20 Jul 2026 8.43 AM
root / root
0644
test_scanstring.py
11.814 KB
20 Jul 2026 8.43 AM
root / root
0644
test_separators.py
0.92 KB
20 Jul 2026 8.43 AM
root / root
0644
test_speedups.py
12.295 KB
20 Jul 2026 8.43 AM
root / root
0644
test_str_subclass.py
0.723 KB
20 Jul 2026 8.43 AM
root / root
0644
test_subclass.py
1.098 KB
20 Jul 2026 8.43 AM
root / root
0644
test_subinterpreters.py
4.53 KB
20 Jul 2026 8.43 AM
root / root
0644
test_tool.py
2.926 KB
20 Jul 2026 8.43 AM
root / root
0644
test_tuple.py
1.788 KB
20 Jul 2026 8.43 AM
root / root
0644
test_unicode.py
6.891 KB
20 Jul 2026 8.43 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF