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_winconsoleio.py
'''Tests for WindowsConsoleIO ''' import io import os import sys import tempfile import unittest from test.support import os_helper, requires_resource if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") from _testconsole import write_input ConIO = io._WindowsConsoleIO class WindowsConsoleIOTests(unittest.TestCase): def test_abc(self): self.assertTrue(issubclass(ConIO, io.RawIOBase)) self.assertFalse(issubclass(ConIO, io.BufferedIOBase)) self.assertFalse(issubclass(ConIO, io.TextIOBase)) def test_open_fd(self): self.assertRaisesRegex(ValueError, "negative file descriptor", ConIO, -1) with tempfile.TemporaryFile() as tmpfile: fd = tmpfile.fileno() # Windows 10: "Cannot open non-console file" # Earlier: "Cannot open console output buffer for reading" self.assertRaisesRegex(ValueError, "Cannot open (console|non-console file)", ConIO, fd) try: f = ConIO(0) except ValueError: # cannot open console because it's not a real console pass else: self.assertTrue(f.readable()) self.assertFalse(f.writable()) self.assertEqual(0, f.fileno()) f.close() # multiple close should not crash f.close() try: f = ConIO(1, 'w') except ValueError: # cannot open console because it's not a real console pass else: self.assertFalse(f.readable()) self.assertTrue(f.writable()) self.assertEqual(1, f.fileno()) f.close() f.close() try: f = ConIO(2, 'w') except ValueError: # cannot open console because it's not a real console pass else: self.assertFalse(f.readable()) self.assertTrue(f.writable()) self.assertEqual(2, f.fileno()) f.close() f.close() def test_open_name(self): self.assertRaises(ValueError, ConIO, sys.executable) f = ConIO("CON") self.assertTrue(f.readable()) self.assertFalse(f.writable()) self.assertIsNotNone(f.fileno()) f.close() # multiple close should not crash f.close() f = ConIO('CONIN$') self.assertTrue(f.readable()) self.assertFalse(f.writable()) self.assertIsNotNone(f.fileno()) f.close() f.close() f = ConIO('CONOUT$', 'w') self.assertFalse(f.readable()) self.assertTrue(f.writable()) self.assertIsNotNone(f.fileno()) f.close() f.close() # bpo-45354: Windows 11 changed MS-DOS device name handling if sys.getwindowsversion()[:3] < (10, 0, 22000): f = open('C:/con', 'rb', buffering=0) self.assertIsInstance(f, ConIO) f.close() @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1), "test does not work on Windows 7 and earlier") def test_conin_conout_names(self): f = open(r'\\.\conin$', 'rb', buffering=0) self.assertIsInstance(f, ConIO) f.close() f = open('//?/conout$', 'wb', buffering=0) self.assertIsInstance(f, ConIO) f.close() def test_conout_path(self): temp_path = tempfile.mkdtemp() self.addCleanup(os_helper.rmtree, temp_path) conout_path = os.path.join(temp_path, 'CONOUT$') with open(conout_path, 'wb', buffering=0) as f: # bpo-45354: Windows 11 changed MS-DOS device name handling if (6, 1) < sys.getwindowsversion()[:3] < (10, 0, 22000): self.assertIsInstance(f, ConIO) else: self.assertNotIsInstance(f, ConIO) def test_write_empty_data(self): with ConIO('CONOUT$', 'w') as f: self.assertEqual(f.write(b''), 0) def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r') old_stdin = sys.stdin try: sys.stdin = stdin write_input( stdin.buffer.raw, (text + '\r\n').encode('utf-16-le', 'surrogatepass') ) actual = input() finally: sys.stdin = old_stdin self.assertEqual(actual, text) @requires_resource('console') def test_input(self): # ASCII self.assertStdinRoundTrip('abc123') # Non-ASCII self.assertStdinRoundTrip('ΟΌΡΠ’Ξ»Π€Π') # Combining characters self.assertStdinRoundTrip('AΝB ο¬Μ³AAΜ') # bpo-38325 @unittest.skipIf(True, "Handling Non-BMP characters is broken") def test_input_nonbmp(self): # Non-BMP self.assertStdinRoundTrip('\U00100000\U0010ffff\U0010fffd') @requires_resource('console') def test_partial_reads(self): # Test that reading less than 1 full character works when stdin # contains multibyte UTF-8 sequences source = 'ΟΌΡΠ’Ξ»Π€Π\r\n'.encode('utf-16-le') expected = 'ΟΌΡΠ’Ξ»Π€Π\r\n'.encode('utf-8') for read_count in range(1, 16): with open('CONIN$', 'rb', buffering=0) as stdin: write_input(stdin, source) actual = b'' while not actual.endswith(b'\n'): b = stdin.read(read_count) actual += b self.assertEqual(actual, expected, 'stdin.read({})'.format(read_count)) # bpo-38325 @unittest.skipIf(True, "Handling Non-BMP characters is broken") def test_partial_surrogate_reads(self): # Test that reading less than 1 full character works when stdin # contains surrogate pairs that cannot be decoded to UTF-8 without # reading an extra character. source = '\U00101FFF\U00101001\r\n'.encode('utf-16-le') expected = '\U00101FFF\U00101001\r\n'.encode('utf-8') for read_count in range(1, 16): with open('CONIN$', 'rb', buffering=0) as stdin: write_input(stdin, source) actual = b'' while not actual.endswith(b'\n'): b = stdin.read(read_count) actual += b self.assertEqual(actual, expected, 'stdin.read({})'.format(read_count)) @requires_resource('console') def test_ctrl_z(self): with open('CONIN$', 'rb', buffering=0) as stdin: source = '\xC4\x1A\r\n'.encode('utf-16-le') expected = '\xC4'.encode('utf-8') write_input(stdin, source) a, b = stdin.read(1), stdin.readall() self.assertEqual(expected[0:1], a) self.assertEqual(expected[1:], b) if __name__ == "__main__": unittest.main()
SIMPAN PERUBAHAN