PATH: //opt/alt/python311/lib64/python3.11/test
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
π Sine-1000Hz-300ms.aif
β
X
π __init__.py
β
X
π __main__.py
β
X
π __pycache__/
X
π _test_atexit.py
β
X
π _test_eintr.py
β
X
π _test_embed_set_config.py
β
X
π _test_embed_structseq.py
β
X
π _test_multiprocessing.py
β
X
π _test_venv_multiprocessing.py
β
X
π archiver_tests.py
β
X
π audiodata/
X
π audiotest.au
β
X
π audiotests.py
β
X
π audit-tests.py
β
X
π autotest.py
β
X
π bisect_cmd.py
β
X
π certdata/
X
π cjkencodings/
X
π clinic.test.c
β
X
π cmath_testcases.txt
β
X
π configdata/
X
π crashers/
X
π curses_tests.py
β
X
π data/
X
π datetimetester.py
β
X
π decimaltestdata/
X
π dis_module.py
β
X
π dtracedata/
X
π empty.vbs
β
X
π encoded_modules/
X
π exception_hierarchy.txt
β
X
π floating_points.txt
β
X
π fork_wait.py
β
X
π formatfloat_testcases.txt
β
X
π ieee754.txt
β
X
π imghdrdata/
X
π imp_dummy.py
β
X
π leakers/
X
π libregrtest/
X
π list_tests.py
β
X
π lock_tests.py
β
X
π mailcap.txt
β
X
π mapping_tests.py
β
X
π math_testcases.txt
β
X
π memory_watchdog.py
β
X
π mime.types
β
X
π mock_socket.py
β
X
π mp_fork_bomb.py
β
X
π mp_preload.py
β
X
π multibytecodec_support.py
β
X
π pickletester.py
β
X
π profilee.py
β
X
π pstats.pck
β
X
π pyclbr_input.py
β
X
π pythoninfo.py
β
X
π randv2_32.pck
β
X
π randv2_64.pck
β
X
π randv3.pck
β
X
π re_tests.py
β
X
π recursion.tar
β
X
π regrtest.py
β
X
π regrtestdata/
X
π relimport.py
β
X
π reperf.py
β
X
π seq_tests.py
β
X
π signalinterproctester.py
β
X
π sndhdrdata/
X
π ssl_servers.py
β
X
π ssltests.py
β
X
π string_tests.py
β
X
π subprocessdata/
X
π support/
X
π test___all__.py
β
X
π test__locale.py
β
X
π test__opcode.py
β
X
π test__osx_support.py
β
X
π test__xxsubinterpreters.py
β
X
π test_abc.py
β
X
π test_abstract_numbers.py
β
X
π test_aifc.py
β
X
π test_argparse.py
β
X
π test_array.py
β
X
π test_asdl_parser.py
β
X
π test_ast.py
β
X
π test_asyncgen.py
β
X
π test_asynchat.py
β
X
π test_asyncio/
X
π test_asyncore.py
β
X
π test_atexit.py
β
X
π test_audioop.py
β
X
π test_audit.py
β
X
π test_augassign.py
β
X
π test_base64.py
β
X
π test_baseexception.py
β
X
π test_bdb.py
β
X
π test_bigaddrspace.py
β
X
π test_bigmem.py
β
X
π test_binascii.py
β
X
π test_binop.py
β
X
π test_bisect.py
β
X
π test_bool.py
β
X
π test_buffer.py
β
X
π test_bufio.py
β
X
π test_builtin.py
β
X
π test_bytes.py
β
X
π test_bz2.py
β
X
π test_c_locale_coercion.py
β
X
π test_calendar.py
β
X
π test_call.py
β
X
π test_capi/
X
π test_cgi.py
β
X
π test_cgitb.py
β
X
π test_charmapcodec.py
β
X
π test_check_c_globals.py
β
X
π test_class.py
β
X
π test_clinic.py
β
X
π test_cmath.py
β
X
π test_cmd.py
β
X
π test_cmd_line.py
β
X
π test_cmd_line_script.py
β
X
π test_code.py
β
X
π test_code_module.py
β
X
π test_codeccallbacks.py
β
X
π test_codecencodings_cn.py
β
X
π test_codecencodings_hk.py
β
X
π test_codecencodings_iso2022.py
β
X
π test_codecencodings_jp.py
β
X
π test_codecencodings_kr.py
β
X
π test_codecencodings_tw.py
β
X
π test_codecmaps_cn.py
β
X
π test_codecmaps_hk.py
β
X
π test_codecmaps_jp.py
β
X
π test_codecmaps_kr.py
β
X
π test_codecmaps_tw.py
β
X
π test_codecs.py
β
X
π test_codeop.py
β
X
π test_collections.py
β
X
π test_colorsys.py
β
X
π test_compare.py
β
X
π test_compile.py
β
X
π test_compileall.py
β
X
π test_complex.py
β
X
π test_concurrent_futures/
X
π test_configparser.py
β
X
π test_contains.py
β
X
π test_context.py
β
X
π test_contextlib.py
β
X
π test_contextlib_async.py
β
X
π test_copy.py
β
X
π test_copyreg.py
β
X
π test_coroutines.py
β
X
π test_cppext/
X
π test_cprofile.py
β
X
π test_crashers.py
β
X
π test_crypt.py
β
X
π test_csv.py
β
X
π test_ctypes.py
β
X
π test_curses.py
β
X
π test_dataclasses/
X
π test_datetime.py
β
X
π test_dbm.py
β
X
π test_dbm_dumb.py
β
X
π test_dbm_gnu.py
β
X
π test_dbm_ndbm.py
β
X
π test_decimal.py
β
X
π test_decorators.py
β
X
π test_defaultdict.py
β
X
π test_deque.py
β
X
π test_descr.py
β
X
π test_descrtut.py
β
X
π test_devpoll.py
β
X
π test_dict.py
β
X
π test_dict_version.py
β
X
π test_dictcomps.py
β
X
π test_dictviews.py
β
X
π test_difflib.py
β
X
π test_difflib_expect.html
β
X
π test_dis.py
β
X
π test_distutils.py
β
X
π test_doctest/
X
π test_docxmlrpc.py
β
X
π test_dtrace.py
β
X
π test_dynamic.py
β
X
π test_dynamicclassattribute.py
β
X
π test_eintr.py
β
X
π test_email/
X
π test_embed.py
β
X
π test_ensurepip.py
β
X
π test_enum.py
β
X
π test_enumerate.py
β
X
π test_eof.py
β
X
π test_epoll.py
β
X
π test_errno.py
β
X
π test_except_star.py
β
X
π test_exception_group.py
β
X
π test_exception_hierarchy.py
β
X
π test_exception_variations.py
β
X
π test_exceptions.py
β
X
π test_extcall.py
β
X
π test_faulthandler.py
β
X
π test_fcntl.py
β
X
π test_file.py
β
X
π test_file_eintr.py
β
X
π test_filecmp.py
β
X
π test_fileinput.py
β
X
π test_fileio.py
β
X
π test_fileutils.py
β
X
π test_finalization.py
β
X
π test_float.py
β
X
π test_flufl.py
β
X
π test_fnmatch.py
β
X
π test_fork1.py
β
X
π test_format.py
β
X
π test_fractions.py
β
X
π test_frame.py
β
X
π test_frozen.py
β
X
π test_fstring.py
β
X
π test_ftplib.py
β
X
π test_funcattrs.py
β
X
π test_functools.py
β
X
π test_future_stmt/
X
π test_gc.py
β
X
π test_gdb/
X
π test_generator_stop.py
β
X
π test_generators.py
β
X
π test_genericalias.py
β
X
π test_genericclass.py
β
X
π test_genericpath.py
β
X
π test_genexps.py
β
X
π test_getopt.py
β
X
π test_getpass.py
β
X
π test_getpath.py
β
X
π test_gettext.py
β
X
π test_glob.py
β
X
π test_global.py
β
X
π test_grammar.py
β
X
π test_graphlib.py
β
X
π test_grp.py
β
X
π test_gzip.py
β
X
π test_hash.py
β
X
π test_hashlib.py
β
X
π test_heapq.py
β
X
π test_hmac.py
β
X
π test_html.py
β
X
π test_htmlparser.py
β
X
π test_http_cookiejar.py
β
X
π test_http_cookies.py
β
X
π test_httplib.py
β
X
π test_httpservers.py
β
X
π test_idle.py
β
X
π test_imaplib.py
β
X
π test_imghdr.py
β
X
π test_imp.py
β
X
π test_import/
X
π test_importlib/
X
π test_index.py
β
X
π test_inspect/
X
π test_int.py
β
X
π test_int_literal.py
β
X
π test_interpreters.py
β
X
π test_io.py
β
X
π test_ioctl.py
β
X
π test_ipaddress.py
β
X
π test_isinstance.py
β
X
π test_iter.py
β
X
π test_iterlen.py
β
X
π test_itertools.py
β
X
π test_json/
X
π test_keyword.py
β
X
π test_keywordonlyarg.py
β
X
π test_kqueue.py
β
X
π test_largefile.py
β
X
π test_launcher.py
β
X
π test_lib2to3.py
β
X
π test_linecache.py
β
X
π test_list.py
β
X
π test_listcomps.py
β
X
π test_lltrace.py
β
X
π test_locale.py
β
X
π test_logging.py
β
X
π test_long.py
β
X
π test_longexp.py
β
X
π test_lzma.py
β
X
π test_mailbox.py
β
X
π test_mailcap.py
β
X
π test_marshal.py
β
X
π test_math.py
β
X
π test_memoryio.py
β
X
π test_memoryview.py
β
X
π test_metaclass.py
β
X
π test_mimetypes.py
β
X
π test_minidom.py
β
X
π test_mmap.py
β
X
π test_module/
X
π test_modulefinder.py
β
X
π test_msilib.py
β
X
π test_multibytecodec.py
β
X
π test_multiprocessing_fork/
X
π test_multiprocessing_forkserver/
X
π test_multiprocessing_main_handling.py
β
X
π test_multiprocessing_spawn/
X
π test_named_expressions.py
β
X
π test_netrc.py
β
X
π test_nis.py
β
X
π test_nntplib.py
β
X
π test_ntpath.py
β
X
π test_numeric_tower.py
β
X
π test_opcache.py
β
X
π test_opcodes.py
β
X
π test_openpty.py
β
X
π test_operator.py
β
X
π test_optparse.py
β
X
π test_ordered_dict.py
β
X
π test_os.py
β
X
π test_ossaudiodev.py
β
X
π test_osx_env.py
β
X
π test_pathlib.py
β
X
π test_patma.py
β
X
π test_pdb.py
β
X
π test_peepholer.py
β
X
π test_peg_generator/
X
π test_pep646_syntax.py
β
X
π test_pickle.py
β
X
π test_picklebuffer.py
β
X
π test_pickletools.py
β
X
π test_pipes.py
β
X
π test_pkg.py
β
X
π test_pkgutil.py
β
X
π test_platform.py
β
X
π test_plistlib.py
β
X
π test_poll.py
β
X
π test_popen.py
β
X
π test_poplib.py
β
X
π test_positional_only_arg.py
β
X
π test_posix.py
β
X
π test_posixpath.py
β
X
π test_pow.py
β
X
π test_pprint.py
β
X
π test_print.py
β
X
π test_profile.py
β
X
π test_property.py
β
X
π test_pstats.py
β
X
π test_pty.py
β
X
π test_pulldom.py
β
X
π test_pwd.py
β
X
π test_py_compile.py
β
X
π test_pyclbr.py
β
X
π test_pydoc/
X
π test_pyexpat.py
β
X
π test_queue.py
β
X
π test_quopri.py
β
X
π test_raise.py
β
X
π test_random.py
β
X
π test_range.py
β
X
π test_re.py
β
X
π test_readline.py
β
X
π test_regrtest.py
β
X
π test_repl.py
β
X
π test_reprlib.py
β
X
π test_resource.py
β
X
π test_richcmp.py
β
X
π test_rlcompleter.py
β
X
π test_robotparser.py
β
X
π test_runpy.py
β
X
π test_sax.py
β
X
π test_sched.py
β
X
π test_scope.py
β
X
π test_script_helper.py
β
X
π test_secrets.py
β
X
π test_select.py
β
X
π test_selectors.py
β
X
π test_set.py
β
X
π test_setcomps.py
β
X
π test_shelve.py
β
X
π test_shlex.py
β
X
π test_shutil.py
β
X
π test_signal.py
β
X
π test_site.py
β
X
π test_slice.py
β
X
π test_smtpd.py
β
X
π test_smtplib.py
β
X
π test_smtpnet.py
β
X
π test_sndhdr.py
β
X
π test_socket.py
β
X
π test_socketserver.py
β
X
π test_sort.py
β
X
π test_source_encoding.py
β
X
π test_spwd.py
β
X
π test_sqlite3/
X
π test_ssl.py
β
X
π test_stable_abi_ctypes.py
β
X
π test_startfile.py
β
X
π test_stat.py
β
X
π test_statistics.py
β
X
π test_strftime.py
β
X
π test_string.py
β
X
π test_string_literals.py
β
X
π test_stringprep.py
β
X
π test_strptime.py
β
X
π test_strtod.py
β
X
π test_struct.py
β
X
π test_structseq.py
β
X
π test_subclassinit.py
β
X
π test_subprocess.py
β
X
π test_sunau.py
β
X
π test_sundry.py
β
X
π test_super.py
β
X
π test_support.py
β
X
π test_symtable.py
β
X
π test_syntax.py
β
X
π test_sys.py
β
X
π test_sys_setprofile.py
β
X
π test_sys_settrace.py
β
X
π test_sysconfig.py
β
X
π test_syslog.py
β
X
π test_tabnanny.py
β
X
π test_tarfile.py
β
X
π test_tcl.py
β
X
π test_telnetlib.py
β
X
π test_tempfile.py
β
X
π test_termios.py
β
X
π test_textwrap.py
β
X
π test_thread.py
β
X
π test_threadedtempfile.py
β
X
π test_threading.py
β
X
π test_threading_local.py
β
X
π test_threadsignals.py
β
X
π test_time.py
β
X
π test_timeit.py
β
X
π test_timeout.py
β
X
π test_tix.py
β
X
π test_tk.py
β
X
π test_tokenize.py
β
X
π test_tomllib/
X
π test_tools/
X
π test_trace.py
β
X
π test_traceback.py
β
X
π test_tracemalloc.py
β
X
π test_ttk_guionly.py
β
X
π test_ttk_textonly.py
β
X
π test_tty.py
β
X
π test_tuple.py
β
X
π test_turtle.py
β
X
π test_type_annotations.py
β
X
π test_type_cache.py
β
X
π test_type_comments.py
β
X
π test_typechecks.py
β
X
π test_types.py
β
X
π test_typing.py
β
X
π test_ucn.py
β
X
π test_unary.py
β
X
π test_unicode.py
β
X
π test_unicode_file.py
β
X
π test_unicode_file_functions.py
β
X
π test_unicode_identifiers.py
β
X
π test_unicodedata.py
β
X
π test_unittest.py
β
X
π test_univnewlines.py
β
X
π test_unpack.py
β
X
π test_unpack_ex.py
β
X
π test_unparse.py
β
X
π test_urllib.py
β
X
π test_urllib2.py
β
X
π test_urllib2_localnet.py
β
X
π test_urllib2net.py
β
X
π test_urllib_response.py
β
X
π test_urllibnet.py
β
X
π test_urlparse.py
β
X
π test_userdict.py
β
X
π test_userlist.py
β
X
π test_userstring.py
β
X
π test_utf8_mode.py
β
X
π test_utf8source.py
β
X
π test_uu.py
β
X
π test_uuid.py
β
X
π test_venv.py
β
X
π test_wait3.py
β
X
π test_wait4.py
β
X
π test_warnings/
X
π test_wave.py
β
X
π test_weakref.py
β
X
π test_weakset.py
β
X
π test_webbrowser.py
β
X
π test_winconsoleio.py
β
X
π test_winreg.py
β
X
π test_winsound.py
β
X
π test_with.py
β
X
π test_wsgiref.py
β
X
π test_xdrlib.py
β
X
π test_xml_dom_minicompat.py
β
X
π test_xml_etree.py
β
X
π test_xml_etree_c.py
β
X
π test_xmlrpc.py
β
X
π test_xmlrpc_net.py
β
X
π test_xxlimited.py
β
X
π test_xxtestfuzz.py
β
X
π test_yield_from.py
β
X
π test_zipapp.py
β
X
π test_zipfile.py
β
X
π test_zipfile64.py
β
X
π test_zipimport.py
β
X
π test_zipimport_support.py
β
X
π test_zlib.py
β
X
π test_zoneinfo/
X
π testcodec.py
β
X
π testtar.tar
β
X
π testtar.tar.xz
β
X
π tf_inherit_check.py
β
X
π time_hashlib.py
β
X
π tokenizedata/
X
π tracedmodules/
X
π typinganndata/
X
π win_console_handler.py
β
X
π xmltestdata/
X
π xmltests.py
β
X
π zip_cp437_header.zip
β
X
π zipdir.zip
β
X
π zipdir_backslash.zip
β
X
π ziptestdata/
X
SAVING...
BERHASIL DIUBAH!
EDITING: test_shelve.py
import unittest import dbm import shelve import glob import pickle import os from test import support from test.support import os_helper from collections.abc import MutableMapping from test.test_dbm import dbm_iterator def L1(s): return s.decode("latin-1") class byteskeydict(MutableMapping): "Mapping that supports bytes keys" def __init__(self): self.d = {} def __getitem__(self, key): return self.d[L1(key)] def __setitem__(self, key, value): self.d[L1(key)] = value def __delitem__(self, key): del self.d[L1(key)] def __len__(self): return len(self.d) def iterkeys(self): for k in self.d.keys(): yield k.encode("latin-1") __iter__ = iterkeys def keys(self): return list(self.iterkeys()) def copy(self): return byteskeydict(self.d) class TestCase(unittest.TestCase): dirname = os_helper.TESTFN fn = os.path.join(os_helper.TESTFN, "shelftemp.db") def test_close(self): d1 = {} s = shelve.Shelf(d1, protocol=2, writeback=False) s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) self.assertEqual(len(s), 1) s.close() self.assertRaises(ValueError, len, s) try: s['key1'] except ValueError: pass else: self.fail('Closed shelf should not find a key') def test_open_template(self, filename=None, protocol=None): os.mkdir(self.dirname) self.addCleanup(os_helper.rmtree, self.dirname) s = shelve.open(filename=filename if filename is not None else self.fn, protocol=protocol) try: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) finally: s.close() def test_ascii_file_shelf(self): self.test_open_template(protocol=0) def test_binary_file_shelf(self): self.test_open_template(protocol=1) def test_proto2_file_shelf(self): self.test_open_template(protocol=2) def test_pathlib_path_file_shelf(self): self.test_open_template(filename=os_helper.FakePath(self.fn)) def test_bytes_path_file_shelf(self): self.test_open_template(filename=os.fsencode(self.fn)) def test_pathlib_bytes_path_file_shelf(self): self.test_open_template(filename=os_helper.FakePath(os.fsencode(self.fn))) def test_in_memory_shelf(self): d1 = byteskeydict() with shelve.Shelf(d1, protocol=0) as s: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) d2 = byteskeydict() with shelve.Shelf(d2, protocol=1) as s: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) self.assertEqual(len(d1), 1) self.assertEqual(len(d2), 1) self.assertNotEqual(d1.items(), d2.items()) def test_mutable_entry(self): d1 = byteskeydict() with shelve.Shelf(d1, protocol=2, writeback=False) as s: s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) s['key1'].append(5) self.assertEqual(s['key1'], [1,2,3,4]) d2 = byteskeydict() with shelve.Shelf(d2, protocol=2, writeback=True) as s: s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) s['key1'].append(5) self.assertEqual(s['key1'], [1,2,3,4,5]) self.assertEqual(len(d1), 1) self.assertEqual(len(d2), 1) def test_keyencoding(self): d = {} key = 'PΓΒΆp' # the default keyencoding is utf-8 shelve.Shelf(d)[key] = [1] self.assertIn(key.encode('utf-8'), d) # but a different one can be given shelve.Shelf(d, keyencoding='latin-1')[key] = [1] self.assertIn(key.encode('latin-1'), d) # with all consequences s = shelve.Shelf(d, keyencoding='ascii') self.assertRaises(UnicodeEncodeError, s.__setitem__, key, [1]) def test_writeback_also_writes_immediately(self): # Issue 5754 d = {} key = 'key' encodedkey = key.encode('utf-8') with shelve.Shelf(d, writeback=True) as s: s[key] = [1] p1 = d[encodedkey] # Will give a KeyError if backing store not updated s['key'].append(2) p2 = d[encodedkey] self.assertNotEqual(p1, p2) # Write creates new object in store def test_with(self): d1 = {} with shelve.Shelf(d1, protocol=2, writeback=False) as s: s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) self.assertEqual(len(s), 1) self.assertRaises(ValueError, len, s) try: s['key1'] except ValueError: pass else: self.fail('Closed shelf should not find a key') def test_default_protocol(self): with shelve.Shelf({}) as s: self.assertEqual(s._protocol, pickle.DEFAULT_PROTOCOL) class TestShelveBase: type2test = shelve.Shelf def _reference(self): return {"key1":"value1", "key2":2, "key3":(1,2,3)} class TestShelveInMemBase(TestShelveBase): def _empty_mapping(self): return shelve.Shelf(byteskeydict(), **self._args) class TestShelveFileBase(TestShelveBase): counter = 0 def _empty_mapping(self): self.counter += 1 x = shelve.open(self.base_path + str(self.counter), **self._args) self.addCleanup(x.close) return x def setUp(self): dirname = os_helper.TESTFN os.mkdir(dirname) self.addCleanup(os_helper.rmtree, dirname) self.base_path = os.path.join(dirname, "shelftemp.db") self.addCleanup(setattr, dbm, '_defaultmod', dbm._defaultmod) dbm._defaultmod = self.dbm_mod from test import mapping_tests for proto in range(pickle.HIGHEST_PROTOCOL + 1): bases = (TestShelveInMemBase, mapping_tests.BasicTestMappingProtocol) name = f'TestProto{proto}MemShelve' globals()[name] = type(name, bases, {'_args': {'protocol': proto}}) bases = (TestShelveFileBase, mapping_tests.BasicTestMappingProtocol) for dbm_mod in dbm_iterator(): assert dbm_mod.__name__.startswith('dbm.') suffix = dbm_mod.__name__[4:] name = f'TestProto{proto}File_{suffix}Shelve' globals()[name] = type(name, bases, {'dbm_mod': dbm_mod, '_args': {'protocol': proto}}) if __name__ == "__main__": unittest.main()
SIMPAN PERUBAHAN