Search
Searching for multiple words only shows matches that contain all words.
Search Results
Search finished, found 782 pages matching the search query.
- test (Python module, in
test— Regression tests package for Python) - doctest (Python module, in
doctest— Test interactive Python examples) - test.regrtest (Python module, in
test— Regression tests package for Python) - unittest (Python module, in
unittest— Unit testing framework) - doctest.DocTestFailure.test (Python attribute, in
doctest— Test interactive Python examples) - doctest.UnexpectedException.test (Python attribute, in
doctest— Test interactive Python examples) doctest— Test interactive Python examplesdoctest — Test interactive Python examples Source code: Lib/doctest.py The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work ex...
keyword— Testing for Python keywordskeyword — Testing for Python keywords Source code: Lib/keyword.py This module allows a Python program to determine if a string is a keyword or soft keyword. keyword.iskeyword(s) Return True if s is a Python keyword....
ssl— TLS/SSL wrapper for socket objects...wn root certificate, and no one else will have it in their cache of known (and trusted) root certificates. Examples Testing for SSL support To test for the presence of SSL support in a Python installation, user code should use the follo...
test— Regression tests package for Pythontest — Regression tests package for Python Note The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s stan...
unittest.mock— getting startedunittest.mock — getting started Added in version 3.3. Using Mock Mock Patching Methods Common uses for Mock objects include: Patching methods Recording method calls on objects You might want to replace a method on an...
unittest— Unit testing frameworkunittest — Unit testing framework Source code: Lib/unittest/__init__.py (If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.) The unittest unit testing fram...
warnings— Warning control...en in Python may wish to hide all Python level warnings from their users by default, and only display them when running tests or otherwise working on the application. The sys.warnoptions attribute used to pass filter configurations to the i...
- 3. Configure Python
...ent files in EPREFIX, defaults to --prefix. This value can be retrieved at runtime using sys.exec_prefix. --disable-test-modules Don’t build nor install test modules, like the test package or the _testcapi extension module (built and in...
- 6. Expressions
...>>> x is 7 <input>:1: SyntaxWarning: "is" with 'int' literal. Did you mean "=="? True See When can I rely on identity tests with the is operator? for more information. Template strings are immutable but may reference mutable objects as I...
- 7. Using Python on iOS
...& Sign” selected. In the “Build Settings” tab, modify the following: Build Options User Script Sandboxing: No Enable Testability: Yes Search Paths Framework Search Paths: $(PROJECT_DIR) Header Search Paths: "$(BUILT_PRODUCTS_DIR)/Pyth...
- Built-in Types
...operations are supported by several object types; in particular, practically all objects can be compared for equality, tested for truth value, and converted to a string (with the repr() function or the slightly different str() function)....
- Changelog
...5: Make gdb ‘py-bt’ command use frame from thread local state when available. Patch by Sam Gross and Victor Stinner. Tests gh-144415: The Android testbed now distinguishes between stdout/stderr messages which were triggered by a newline...
- Functional Programming HOWTO
...and practical advantages to the functional style: Formal provability. Modularity. Composability. Ease of debugging and testing. Formal provability A theoretical benefit is that it’s easier to construct a mathematical proof that a functio...
- General Python FAQ
...grammed before. Is there a Python tutorial? Is there a newsgroup or mailing list devoted to Python? How do I get a beta test version of Python? How do I submit bug reports and patches for Python? Are there any published articles about Pytho...
- History and License
...nse Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any...
- Library and Extension FAQ
...r Python? Is there an equivalent to C’s onexit() in Python? Why don’t my signal handlers work? Common tasks How do I test a Python program or component? How do I create documentation from doc strings? How do I get a single keypress at a...
- Programming FAQ
...ist of all instances of a given class? Why does the result of id() appear to be not unique? When can I rely on identity tests with the is operator? How can a subclass control what data is stored in an immutable instance? How do I cache meth...
- test.support (Python module, in
test— Regression tests package for Python) - test.support.bytecode_helper (Python module, in
test— Regression tests package for Python) - test.support.import_helper (Python module, in
test— Regression tests package for Python) - test.support.os_helper (Python module, in
test— Regression tests package for Python) - test.support.script_helper (Python module, in
test— Regression tests package for Python) - test.support.socket_helper (Python module, in
test— Regression tests package for Python) - test.support.threading_helper (Python module, in
test— Regression tests package for Python) - test.support.warnings_helper (Python module, in
test— Regression tests package for Python) - unittest.mock (Python module, in
unittest.mock— mock object library) - What’s New In Python 3.13
...rove this over the next few releases. Color support in the new interactive interpreter, as well as in tracebacks and doctest output. This can be disabled through the PYTHON_COLORS and NO_COLOR environment variables. Python data model impro...
- What’s New In Python 3.5
...lico and Guido van Rossum. Implemented by Chris Angelico, Yury Selivanov and Nick Coghlan. PEP 485: A function for testing approximate equality PEP 485 adds the math.isclose() and cmath.isclose() functions which tell whether two values...
- Changelog > Tests
Tests bpo-18982: Add tests for CLI of the calendar module. bpo-19548: Added some additional checks to test_codecs to ensure that statements in the updated documentation remain accurate. Patch by Martin Panter. bpo-22838: All test_re tests...
- Changelog > Tests
Tests bpo-23583: Added tests for standard IO streams in IDLE. bpo-22289: Prevent test_urllib2net failures due to ftp connection timeout.
- Changelog > Tests
Tests bpo-23799: Added test.support.start_threads() for running and cleaning up multiple threads. bpo-22390: test.regrtest now emits a warning if temporary files or directories are left after running a test.
- Changelog > Tests
Tests bpo-21520: test_zipfile no longer fails if the word ‘bad’ appears anywhere in the name of the current directory. bpo-9517: Move script_helper into the support package. Patch by Christie Wilson.
- Changelog > Tests
Tests bpo-24373: _testmultiphase and xxlimited now use tp_traverse and tp_finalize to avoid reference leaks encountered when combining tp_dealloc with PyType_FromSpec (see bpo-16690 for details)
- Changelog > Tests
Tests bpo-24751: When running regrtest with the -w command line option, a test run is no longer marked as a failure if all tests succeed when re-run.
- Changelog > Tests
Tests bpo-25449: Added tests for OrderedDict subclasses. bpo-25099: Make test_compileall not fail when an entry on sys.path cannot be written to (commonly seen in administrative installs on Windows). bpo-23919: Prevents assert dialogs app...
- Changelog > Tests
Tests bpo-21916: Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle Zijlstra. bpo-26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. bpo-26015: Added new tests for pickling iterator...
- Changelog > Tests
Tests bpo-26867: Ubuntu’s openssl OP_NO_SSLv3 is forced on by default; fix test.
- Changelog > Tests
Tests bpo-28950: Disallow -j0 to be combined with -T/-l/-M in regrtest command line arguments. bpo-28666: Now test.support.rmtree is able to remove unwritable or unreadable directories. bpo-23839: Various caches now are cleared before run...
- Changelog > Tests
Tests bpo-30822: Fix regrtest command line parser to allow passing -u extralargefile to run test_zipfile64. bpo-30383: regrtest: Enhance regrtest and backport features from the master branch. Add options: –coverage, –testdir, –list-tests...
- Changelog > Tests
Tests bpo-21916: Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle Zijlstra. bpo-26295: When using “python3 -m test –testdir=TESTDIR”, regrtest doesn’t add “test.” prefix to test module names. bpo-26523: The mul...
- Changelog > Tests
Tests bpo-25285: regrtest now uses subprocesses when the -j1 command line option is used: each test file runs in a fresh child process. Before, the -j1 option was ignored. bpo-25285: Tools/buildbot/test.bat script now uses -j1 by default...
- Changelog > Tests
Tests bpo-27027: Added test.support.is_android that is True when this is an Android build.
- Changelog > Tests
Tests bpo-25805: Skip a test in test_pkgutil as needed that doesn’t work when __name__ == __main__. Patch by SilentGhost. bpo-27472: Add test.support.unix_shell as the path to the default shell. bpo-27369: In test_pyexpat, avoid testing a...
- Changelog > Tests
Tests bpo-27427: Additional tests for the math module. Patch by Francisco Couzo. bpo-27953: Skip math and cmath tests that fail on OS X 10.4 due to a poor libm implementation of tan. bpo-26040: Improve test_math and test_cmath coverage an...
- Changelog > Tests
Tests bpo-28217: Adds _testconsole module to test console input.
- Changelog > Tests
Tests bpo-26944: Fix test_posix for Android where ‘id -G’ is entirely wrong or missing the effective gid. bpo-28409: regrtest: fix the parser of command line arguments.
- Changelog > Tests
Tests bpo-28666: Now test.support.rmtree is able to remove unwritable or unreadable directories. bpo-23839: Various caches now are cleared before running every test file.
- Changelog > Tests
Tests bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. Skip some tests of select.poll when running on macOS due to unresolved issues with the underlying system poll function on some macOS versions. bpo-29571: to match...
- Changelog > Tests
Tests bpo-30357: test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Initial patch written by Grzegorz Grzywacz. bpo-30197...
- Changelog > Tests
Tests bpo-31320: Silence traceback in test_ssl bpo-25674: Remove sha256.tbs-internet.com ssl test bpo-30715: Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves like OpenSSL 1.0.2 and no longer aborts handshake. b...
- Changelog > Tests
Tests bpo-31380: Skip test_httpservers test_undecodable_file on macOS: fails on APFS. bpo-31705: Skip test_socket.test_sha256() on Linux kernel older than 4.5. The test fails with ENOKEY on kernel 3.10 (on ppc64le). A fix was merged into...
- Changelog > Tests
Tests bpo-32517: Fix failing test_asyncio on macOS 10.12.2+ due to transport of KqueueSelector loop was not being closed. bpo-32721: Fix test_hashlib to not fail if the _md5 module is not built. bpo-32252: Fix faulthandler_suppress_crash_...
- Changelog > Tests
Tests bpo-32872: Avoid regrtest compatibility issue with namespace packages.
- Changelog > Tests
Tests bpo-33655: Ignore test_posix_fallocate failures on BSD platforms that might be due to running on ZFS. bpo-19417: Add test_bdb.py.
- Changelog > Tests
Tests bpo-29639: test.support.HOST is now “localhost”, a new HOSTv4 constant has been added for your 127.0.0.1 needs, similar to the existing HOSTv6 constant. bpo-31320: Silence traceback in test_ssl bpo-31346: Prefer PROTOCOL_TLS_CLIENT...
- Changelog > Tests
Tests bpo-31380: Skip test_httpservers test_undecodable_file on macOS: fails on APFS. bpo-31705: Skip test_socket.test_sha256() on Linux kernel older than 4.5. The test fails with ENOKEY on kernel 3.10 (on ppc64le). A fix was merged into...
- Changelog > Tests
Tests bpo-32252: Fix faulthandler_suppress_crash_report() used to prevent core dump files when testing crashes. getrlimit() returns zero on success. bpo-32002: Adjust C locale coercion testing for the empty locale and POSIX locale cases t...
- Changelog > Tests
Tests bpo-32721: Fix test_hashlib to not fail if the _md5 module is not built. bpo-28414: Add test cases for IDNA 2003 and 2008 host names. IDNA 2003 internationalized host names are working since bpo-31399 has landed. IDNA 2008 are still...
- Changelog > Tests
Tests bpo-31809: Add tests to verify connection with secp ECDH curves.
- Changelog > Tests
Tests bpo-32872: Avoid regrtest compatibility issue with namespace packages. bpo-32517: Fix failing test_asyncio on macOS 10.12.2+ due to transport of KqueueSelector loop was not being closed. bpo-19417: Add test_bdb.py.
- Changelog > Tests
Tests bpo-33358: Fix test_embed.test_pre_initialization_sys_options() when the interpreter is built with --enable-shared.
- Changelog > Tests
Tests bpo-33655: Ignore test_posix_fallocate failures on BSD platforms that might be due to running on ZFS. bpo-32604: Remove the _xxsubinterpreters module (meant for testing) and associated helpers. This module was originally added rece...
- Changelog > Tests
Tests bpo-35772: Fix sparse file tests of test_tarfile on ppc64 with the tmpfs filesystem. Fix the function testing if the filesystem supports sparse files: create a file which contains data and “holes”, instead of creating a file which c...
- Changelog > Tests
Tests bpo-27313: Avoid test_ttk_guionly ComboboxTest failure with macOS Cocoa Tk. bpo-36019: Add test.support.TEST_HTTP_URL and replace references of http://www.example.com by this new constant. Contributed by Stéphane Wirtel. bpo-36037:...
- Changelog > Tests
Tests bpo-36234: test_posix.PosixUidGidTests: add tests for invalid uid/gid type (str). Initial patch written by David Malcolm. bpo-29571: Fix test_re.test_locale_flag(): use locale.getpreferredencoding() rather than locale.getlocale() t...
- Changelog > Tests
Tests bpo-36719: regrtest now always detects uncollectable objects. Previously, the check was only enabled by --findleaks. The check now also works with -jN/--multiprocess N. --findleaks becomes a deprecated alias to --fail-env-changed. b...
- Changelog > Tests
Tests bpo-37069: Modify test_coroutines, test_cprofile, test_generators, test_raise, test_ssl and test_yield_from to use test.support.catch_unraisable_exception() rather than test.support.captured_stderr(). bpo-37098: Fix test_memfd_creat...
- Changelog > Tests
Tests bpo-38614: Fix test_communicate() of test_asyncio.test_subprocess: use support.LONG_TIMEOUT (5 minutes), instead of just 1 minute. bpo-38614: Add timeout constants to test.support: LOOPBACK_TIMEOUT, INTERNET_TIMEOUT, SHORT_TIMEOUT a...
- Changelog > Tests
Tests bpo-38546: Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly stop the manager to prevent leaking a child process running in the background after the test completes. bpo-38546: Multiprocessing and concurren...
- Changelog > Tests
Tests bpo-38325: Skip tests on non-BMP characters of test_winconsoleio. bpo-39502: Skip test_zipfile.test_add_file_after_2107() if time.localtime() fails with OverflowError. It is the case on AIX 6.1 for example.
- Changelog > Tests
Tests bpo-40019: test_gdb now skips tests if it detects that gdb failed to read debug information because the Python binary is optimized. bpo-27807: test_site.test_startup_imports() is now skipped if a path of sys.path contains a .pth fil...
- Changelog > Tests
Tests bpo-31904: Set expected default encoding in test_c_locale_coercion.py for VxWorks RTOS. bpo-40162: Update Travis CI configuration to OpenSSL 1.1.1f. bpo-40146: Update OpenSSL to 1.1.1f in Azure Pipelines. bpo-40094: Add test.support...
- Changelog > Tests
Tests bpo-40055: distutils.tests now saves/restores warnings filters to leave them unchanged. Importing tests imports docutils which imports pkg_resources which adds a warnings filter. bpo-40436: test_gdb and test.pythoninfo now check gdb...
- Changelog > Tests
Tests bpo-41939: Fix test_site.test_license_exists_at_url(): call urllib.request.urlcleanup() to reset the global urllib.request._opener. Patch by Victor Stinner. bpo-41731: Make test_cmd_line_script pass with option ‘-vv’. bpo-41602: Add...
- Changelog > Tests
Tests bpo-41739: Fix test_logging.test_race_between_set_target_and_flush(): the test now waits until all threads complete to avoid leaking running threads. bpo-41970: Avoid a test failure in test_lib2to3 if the module has already imported...
- Changelog > Tests
Tests bpo-41473: Re-enable test_gdb on gdb 9.2 and newer: https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb 10.1. bpo-42553: Fix test_asyncio.test_call_later() race condition: don’t measure asyncio performance in the...
- Changelog > Tests
Tests bpo-42794: Update test_nntplib to use official group name of news.aioe.org for testing. Patch by Donghee Na. bpo-31904: Skip some asyncio tests on VxWorks. bpo-42641: Enhance test_select.test_select(): it now takes 500 milliseconds...
- Changelog > Tests
Tests bpo-40823: Use unittest.TestLoader().loadTestsFromTestCase() instead of unittest.makeSuite() in sqlite3 tests. Patch by Erlend E. Aasland. bpo-40810: In sqlite3, fix CheckTraceCallbackContent for SQLite pre 3.7.15.
- Changelog > Tests
Tests bpo-43288: Fix test_importlib to correctly skip Unicode file tests if the filesystem does not support them.
- Changelog > Tests
Tests bpo-37945: Fix test_getsetlocale_issue1813() of test_locale: skip the test if setlocale() fails. Patch by Victor Stinner. bpo-41561: Add workaround for Ubuntu’s custom OpenSSL security level policy.
- Changelog > Tests
Tests bpo-43961: Fix test_logging.test_namer_rotator_inheritance() on Windows: use os.replace() rather than os.rename(). Patch by Victor Stinner. bpo-43842: Fix a race condition in the SMTP test of test_logging. Don’t close a file descrip...
- Changelog > Tests
Tests bpo-40173: Fix test.support.import_helper.import_fresh_module(). bpo-45280: Add a test case for empty typing.NamedTuple. bpo-45269: Cover case when invalid markers type is supplied to c_make_encoder. bpo-45128: Fix test_multiprocess...
- Changelog > Tests
Tests bpo-45678: Add tests for scenarios in which functools.singledispatchmethod is stacked on top of a method that has already been wrapped by two other decorators. Patch by Alex Waygood. bpo-45578: Add tests for dis.distb() bpo-45678: A...
- Changelog > Tests
Tests bpo-45695: Out-of-tree builds with a read-only source directory are now tested by CI. bpo-19460: Add new Test for Lib/email/mime/nonmultipart.py::MIMENonMultipart. bpo-45835: Fix race condition in test_queue tests with multiple “fee...
- Changelog > Tests
Tests bpo-46296: Add a test case for enum with _use_args_ == True and _member_type_ == object. bpo-46205: Fix hang in runtest_mp due to race condition bpo-46263: Fix test_capi on FreeBSD 14-dev: instruct jemalloc to not fill freed memory...
- Changelog > Tests
Tests bpo-43478: Mocks can no longer be provided as the specs for other Mocks. As a result, an already-mocked object cannot be passed to mock.Mock(). This can uncover bugs in tests since these Mock-derived Mocks will always pass certain t...
- Changelog > Tests
Tests bpo-46913: Fix test_faulthandler.test_sigfpe() if Python is built with undefined behavior sanitizer (UBSAN): disable UBSAN on the faulthandler_sigfpe() function. Patch by Victor Stinner. bpo-46760: Remove bytecode offsets from expec...
- Changelog > Tests
Tests bpo-47205: Skip test for sched_getaffinity() and sched_setaffinity() error case on FreeBSD. bpo-46126: Restore ‘descriptions’ when running tests internally. bpo-47104: Rewrite asyncio.to_thread() tests to use unittest.IsolatedAsynci...
- Changelog > Tests
Tests gh-92169: Use warnings_helper.import_deprecated() to import deprecated modules uniformly in tests. Patch by Hugo van Kemenade. gh-84461: When multiprocessing is enabled, libregrtest can now use a Python executable other than sys.exe...
- Changelog > Tests
Tests gh-95027: On Windows, when the Python test suite is run with the -jN option, the ANSI code page is now used as the encoding for the stdout temporary file, rather than using UTF-8 which can lead to decoding errors. Patch by Victor St...
- Changelog > Tests
Tests gh-98903: The Python test suite now fails with exit code 4 if no tests ran. It should help detecting typos in test names and test methods. gh-98713: Fix a bug in the typing tests where a test relying on CPython-specific implementati...
- Changelog > Tests
Tests gh-99892: Skip test_normalization() of test_unicodedata if it fails to download NormalizationTest.txt file from pythontest.net. Patch by Victor Stinner. gh-99934: Correct test_marsh on (32 bit) x86: test_deterministic sets was faili...
- Changelog > Tests
Tests gh-100454: Start running SSL tests with OpenSSL 3.1.0-beta1. gh-100086: The Python test runner (libregrtest) now logs Python build information like “debug” vs “release” build, or LTO and PGO optimizations. Patch by Victor Stinner. g...
- Changelog > Tests
Tests gh-101334: test_tarfile has been updated to pass when run as a high UID.
- Changelog > Tests
Tests gh-102019: Fix deadlock on shutdown if test_current_{exception,frames} fails. Patch by Jacob Bower. gh-85984: Utilize new “winsize” functions from termios in pty tests. gh-89792: test_tools now copies up to 10x less source data to a...
- Changelog > Tests
Tests gh-102980: Improve test coverage on pdb. gh-102537: Adjust the error handling strategy in test_zoneinfo.TzPathTest.python_tzpath_context. Patch by Paul Ganssle. gh-101377: Improved test_locale_calendar_formatweekday of calendar.
- Changelog > Tests
Tests gh-104494: Update test_pack_configure_in and test_place_configure_in for changes to error message formatting in Tk 8.7. gh-104461: Run test_configure_screen on X11 only, since the DISPLAY environment variable and -screen option for...
- Changelog > Tests
Tests gh-110647: Fix test_stress_modifying_handlers() of test_signal. Patch by Victor Stinner. gh-103053: Fix test_tools.test_freeze on FreeBSD: run “make distclean” instead of “make clean” in the copied source directory to remove also th...
- Changelog > Tests
Tests gh-111808: Make the default value of test.support.infinite_recursion() to be conditional based on whether optimizations were used when compiling the interpreter. This helps with platforms like WASI whose stack size is greatly restri...
- Changelog > Tests
Tests gh-111798: Disable test_super_deep() from test_call under pydebug builds on WASI; the stack depth is too small to make the test useful. gh-111801: Lower the recursion limit in test_isinstance for test_infinitely_many_bases(). This p...
- Changelog > Tests
Tests gh-114099: Added test exclusions required to run the test suite on iOS. gh-105089: Fix test.test_zipfile.test_core.TestWithDirectory.test_create_directory_with_write test in AIX by doing a bitwise AND of 0xFFFF on mode , so that it...
- Changelog > Tests
Tests gh-71052: Add test exclusions to support running the test suite on Android. gh-71052: Enable test_concurrent_futures on platforms that support threading but not multiprocessing. gh-115796: Make ‘_testinternalcapi.assemble_code_objec...
- Changelog > Tests
Tests gh-83434: Disable JUnit XML output (--junit-xml=FILE command line option) in regrtest when hunting for reference leaks (-R option). Patch by Victor Stinner. gh-117187: Fix XML tests for vanilla Expat <2.6.0. gh-116333: Tests of TLS...
- Changelog > Tests
Tests gh-125041: Re-enable skipped tests for zlib on the s390x architecture: only skip checks of the compressed bytes, which can be different between zlib’s software implementation and the hardware-accelerated implementation. gh-124378: U...
- Changelog > Tests
Tests gh-126909: Fix test_os extended attribute tests to work on filesystems with 1 KiB xattr size limit. gh-125730: Change make test to not run GUI tests by default. Use make ci to run tests with GUI tests instead. gh-124295: Add transla...
- Changelog > Tests
Tests gh-127906: Test the limited C API in test_cppext. Patch by Victor Stinner. gh-127637: Add tests for the dis command-line interface. Patch by Bénédikt Tran. gh-126925: iOS test results are now streamed during test execution, and the...
- Changelog > Tests
Tests gh-128690: Temporarily do not use test_embed in PGO profile builds until the problem with test_init_pyvenv_cfg failing in some configurations is resolved.
- Changelog > Tests
Tests gh-129386: Add test.support.reset_code, which can be used to reset various bytecode-level optimizations and local instrumentation for a function. gh-128474: Disable test_embed test cases that segfault on BOLT instrument binaries. Th...
- Changelog > Tests
Tests gh-129200: Multiple iOS testbed runners can now be started at the same time without introducing an ambiguity over simulator ownership. gh-130292: The iOS testbed will now run successfully on a machine that has not previously run Xco...
- Changelog > Tests
Tests gh-131277: Allow to unset one or more environment variables at once via EnvironmentVarGuard.unset(). Patch by Bénédikt Tran. gh-131050: test_ssl.test_dh_params is skipped if the underlying TLS library does not support finite-field e...
- Changelog > Tests
Tests gh-133131: The iOS testbed will now select the most recently released “SE-class” device for testing if a device isn’t explicitly specified. gh-91048: Add ability to externally inspect all pending asyncio tasks, even if no task is cu...
- Changelog > Tests
Tests gh-133744: Fix multiprocessing interrupt test. Add an event to synchronize the parent process with the child process: wait until the child process starts sleeping. Patch by Victor Stinner. gh-133682: Fixed test case test.test_annota...
- Changelog > Tests
Tests gh-132815: Fix test__opcode: add JUMP_BACKWARD to specialization stats. gh-135489: Show verbose output for failing tests during PGO profiling step with –enable-optimizations. gh-135120: Add test.support.subTests().
- Changelog > Tests
Tests gh-135966: The iOS testbed now handles the app_packages folder as a site directory. gh-135494: Fix regrtest to support excluding tests from --pgo tests. Patch by Victor Stinner.
- Changelog > Tests
Tests gh-140482: Preserve and restore the state of stty echo as part of the test environment. gh-140082: Update python -m test to set FORCE_COLOR=1 when being run with color enabled so that unittest which is run by it with redirected outp...
- Changelog > Tests
Tests gh-144415: The Android testbed now distinguishes between stdout/stderr messages which were triggered by a newline, and those triggered by a manual call to flush. This fixes logging of progress indicators and similar content. gh-1434...
- --disable-test-modules (program option, in 3. Configure Python)
- ast.TemplateStr (Python class, in
ast— Abstract syntax trees) - collections.abc.ByteString (Python class, in
collections.abc— Abstract Base Classes for Containers) - doctest.DocTest (Python class, in
doctest— Test interactive Python examples) - doctest.DocTestFailure (Python exception, in
doctest— Test interactive Python examples) - doctest.DocTestFinder (Python class, in
doctest— Test interactive Python examples) - doctest.DocTestParser (Python class, in
doctest— Test interactive Python examples) - doctest.DocTestParser.get_doctest (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner (Python class, in
doctest— Test interactive Python examples) - doctest.DocTestSuite (Python function, in
doctest— Test interactive Python examples) - doctest.set_unittest_reportflags (Python function, in
doctest— Test interactive Python examples) - doctest.testfile (Python function, in
doctest— Test interactive Python examples) - doctest.testmod (Python function, in
doctest— Test interactive Python examples) - doctest.TestResults (Python class, in
doctest— Test interactive Python examples) - doctest.testsource (Python function, in
doctest— Test interactive Python examples) - module.__test__ (Python attribute, in
doctest— Test interactive Python examples) - os.F_TEST (Python data, in
os— Miscellaneous operating system interfaces) - PyFile_WriteString (C function, in File Objects)
- PySys_WriteStderr (C function, in Operating System Utilities)
- PySys_WriteStdout (C function, in Operating System Utilities)
- PyUnicodeWriter_WriteStr (C function, in Unicode Objects and Codecs)
- tarfile.--test (program option, in
tarfile— Read and write tar archive files) - test.support.bigaddrspacetest (Python function, in
test— Regression tests package for Python) - test.support.bigmemtest (Python function, in
test— Regression tests package for Python) - test.support.bytecode_helper.BytecodeTestCase (Python class, in
test— Regression tests package for Python) - test.support.load_package_tests (Python function, in
test— Regression tests package for Python) - test.support.os_helper.TESTFN (Python data, in
test— Regression tests package for Python) - test.support.os_helper.TESTFN_NONASCII (Python data, in
test— Regression tests package for Python) - test.support.os_helper.TESTFN_UNDECODABLE (Python data, in
test— Regression tests package for Python) - test.support.os_helper.TESTFN_UNENCODABLE (Python data, in
test— Regression tests package for Python) - test.support.os_helper.TESTFN_UNICODE (Python data, in
test— Regression tests package for Python) - test.support.refcount_test (Python function, in
test— Regression tests package for Python) - test.support.TEST_DATA_DIR (Python data, in
test— Regression tests package for Python) - test.support.TEST_HOME_DIR (Python data, in
test— Regression tests package for Python) - test.support.TEST_HTTP_URL (Python data, in
test— Regression tests package for Python) - test.support.TEST_SUPPORT_DIR (Python data, in
test— Regression tests package for Python) - test.support.TestFailed (Python exception, in
test— Regression tests package for Python) - typing.ByteString (Python class, in
typing— Support for type hints) - unittest.defaultTestLoader (Python data, in
unittest— Unit testing framework) - unittest.FunctionTestCase (Python class, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase (Python class, in
unittest— Unit testing framework) - unittest.SkipTest (Python exception, in
unittest— Unit testing framework) - unittest.TestCase (Python class, in
unittest— Unit testing framework) - unittest.TestCase.countTestCases (Python method, in
unittest— Unit testing framework) - unittest.TestCase.defaultTestResult (Python method, in
unittest— Unit testing framework) - unittest.TestCase.skipTest (Python method, in
unittest— Unit testing framework) - unittest.TestCase.subTest (Python method, in
unittest— Unit testing framework) - unittest.TestLoader (Python class, in
unittest— Unit testing framework) - unittest.TestLoader.getTestCaseNames (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.loadTestsFromModule (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.loadTestsFromName (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.loadTestsFromNames (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.loadTestsFromTestCase (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.sortTestMethodsUsing (Python attribute, in
unittest— Unit testing framework) - unittest.TestLoader.testMethodPrefix (Python attribute, in
unittest— Unit testing framework) - unittest.TestLoader.testNamePatterns (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult (Python class, in
unittest— Unit testing framework) - unittest.TestResult.addSubTest (Python method, in
unittest— Unit testing framework) - unittest.TestResult.startTest (Python method, in
unittest— Unit testing framework) - unittest.TestResult.startTestRun (Python method, in
unittest— Unit testing framework) - unittest.TestResult.stopTest (Python method, in
unittest— Unit testing framework) - unittest.TestResult.stopTestRun (Python method, in
unittest— Unit testing framework) - unittest.TestResult.testsRun (Python attribute, in
unittest— Unit testing framework) - unittest.TestSuite (Python class, in
unittest— Unit testing framework) - unittest.TestSuite.addTest (Python method, in
unittest— Unit testing framework) - unittest.TestSuite.addTests (Python method, in
unittest— Unit testing framework) - unittest.TestSuite.countTestCases (Python method, in
unittest— Unit testing framework) - unittest.TextTestResult (Python class, in
unittest— Unit testing framework) - unittest.TextTestRunner (Python class, in
unittest— Unit testing framework) - wsgiref.util.setup_testing_defaults (Python function, in
wsgiref— WSGI Utilities and Reference Implementation) - xml.sax.xmlreader.InputSource.getByteStream (Python method, in
xml.sax.xmlreader— Interface for XML parsers) - xml.sax.xmlreader.InputSource.setByteStream (Python method, in
xml.sax.xmlreader— Interface for XML parsers) - zipfile.--test (program option, in
zipfile— Work with ZIP archives) - zipfile.ZipFile.testzip (Python method, in
zipfile— Work with ZIP archives) - zipfile.ZipFile.writestr (Python method, in
zipfile— Work with ZIP archives) - What’s New in Python 2.4 > doctest
doctest The doctest module underwent considerable refactoring thanks to Edward Loper and Tim Peters. Testing can still be as simple as running doctest.testmod(), but the refactorings allow customizing the module’s operation in various way...
- What’s New In Python 3.10 > doctest
doctest When a module does not define __loader__, fall back to __spec__.loader. (Contributed by Brett Cannon in bpo-42133.)
- What’s New In Python 3.13 > doctest
doctest doctest output is now colored by default. This can be controlled via the new PYTHON_COLORS environment variable as well as the canonical NO_COLOR and FORCE_COLOR environment variables. See also Controlling color. (Contributed by H...
- What’s New In Python 3.4 > doctest
doctest A new option flag, FAIL_FAST, halts test running as soon as the first failure is detected. (Contributed by R. David Murray and Daniel Urban in bpo-16522.) The doctest command line interface now uses argparse, and has two new optio...
- What’s New In Python 3.5 > doctest
doctest The DocTestSuite() function returns an empty unittest.TestSuite if module contains no docstrings, instead of raising ValueError. (Contributed by Glenn Jones in bpo-15916.)
- What’s New In Python 3.10 > unittest
unittest Add new method assertNoLogs() to complement the existing assertLogs(). (Contributed by Kit Yan Choi in bpo-39385.)
- What’s New In Python 3.11 > unittest
unittest Added methods enterContext() and enterClassContext() of class TestCase, method enterAsyncContext() of class IsolatedAsyncioTestCase and function unittest.enterModuleContext(). (Contributed by Serhiy Storchaka in bpo-45046.)
- What’s New In Python 3.12 > unittest
unittest Remove many long-deprecated unittest features: A number of TestCase method aliases: Deprecated alias Method Name Deprecated in failUnless assertTrue() 3.1 failIf assertFalse() 3.1 failUnlessEqual assertEqual() 3.1 failIf...
- What’s New In Python 3.12 > unittest
unittest Add a --durations command line option, showing the N slowest test cases: python3 -m unittest --durations=3 lib.tests.test_threading ..... Slowest test durations ---------------------------------------------------------------------...
- What’s New In Python 3.13 > unittest
unittest Remove the following unittest functions, deprecated in Python 3.11: unittest.findTestCases() unittest.makeSuite() unittest.getTestCaseNames() Use TestLoader methods instead: loadTestsFromModule() loadTestsFromTestCase() getTes...
- What’s new in Python 3.14 > unittest
unittest unittest output is now colored by default. This can be controlled by environment variables. (Contributed by Hugo van Kemenade in gh-127221.) unittest discovery supports namespace package as start directory again. It was removed i...
- What’s New In Python 3.2 > unittest
unittest The unittest module has a number of improvements supporting test discovery for packages, easier experimentation at the interactive prompt, new testcase methods, improved diagnostic messages for test failures, and better method nam...
- What’s New In Python 3.3 > unittest
unittest assertRaises(), assertRaisesRegex(), assertWarns(), and assertWarnsRegex() now accept a keyword argument msg when used as context managers. (Contributed by Ezio Melotti and Winston Ewert in bpo-10775.) unittest.TestCase.run() now...
- What’s New In Python 3.4 > unittest
unittest The TestCase class has a new method, subTest(), that produces a context manager whose with block becomes a “sub-test”. This context manager allows a test method to dynamically generate subtests by, say, calling the subTest conte...
- What’s New In Python 3.5 > unittest
unittest The TestLoader.loadTestsFromModule() method now accepts a keyword-only argument pattern which is passed to load_tests as the third argument. Found packages are now checked for load_tests regardless of whether their path matches p...
- What’s New In Python 3.7 > unittest
unittest The new -k command-line option allows filtering tests by a name substring or a Unix shell-like pattern. For example, python -m unittest -k foo runs foo_tests.SomeTest.test_something, bar_tests.SomeTest.test_foo, but not bar_tests....
- What’s New In Python 3.8 > unittest
unittest Added AsyncMock to support an asynchronous version of Mock. Appropriate new assert functions for testing have been added as well. (Contributed by Lisa Roach in bpo-26467). Added addModuleCleanup() and addClassCleanup() to unittes...
__main__— Top-level code environment...or fetching data from standard input. If a module like this was imported from a different module, for example to unit test it, the script code would unintentionally execute as well. This is where using the if __name__ == '__main__' code b...
abc— Abstract Base Classes...these can, of course, be further derived. In addition, the collections.abc submodule has some ABCs that can be used to test whether a class or instance provides a particular interface, for example, if it is hashable or if it is a mapping....
argparse— Parser for command-line options, arguments and subcommands...+', ... help='an integer for the accumulator') >>> parser.parse_args(['--action', 'sumn', 1, 2, 3]) tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max') If you’...
ast— Abstract syntax trees...nt) | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment) | While(expr test, stmt* body, stmt* orelse) | If(expr test, stmt* body, stmt* orelse) | With(withitem* items, st...
cmath— Mathematical functions for complex numbers...NaN. inf and -inf are only considered close to themselves. Added in version 3.5. See also PEP 485 – A function for testing approximate equality Constants cmath.pi The mathematical constant π, as a float. cmath.e The mathemat...
cmd— Support for line-oriented command interpreters...The Cmd class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface. cla...
codecs— Codec registry and base classes...es are not escaped in any way. It is used in the Python pickle protocol. undefined This Codec should only be used for testing purposes. Raise an exception for all conversions, even empty strings. The error handler is ignored. unicode_es...
collections.abc— Abstract Base Classes for Containers...llections module. Source code: Lib/_collections_abc.py This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping. An...
collections— Container datatypes...support rich comparison operators for equality, subset, and superset relationships: ==, !=, <, <=, >, >=. All of those tests treat missing elements as having zero counts so that Counter(a=1) == Counter(a=1, b=0) returns true. Changed in v...
concurrent.futures— Launching parallel tasks...ecution of a callable. Future instances are created by Executor.submit() and should not be created directly except for testing. cancel() Attempt to cancel the call. If the call is currently being executed or finished running and cannot...
contextvars— Context Variables...handle_request, '127.0.0.1', 8081) async with srv: await srv.serve_forever() asyncio.run(main()) # To test it you can use telnet or curl: # telnet 127.0.0.1 8081 # curl 127.0.0.1:8081
ctypes— A foreign function library for Python...the distributor, see Requirements for optional modules. ctypes tutorial Note: The code samples in this tutorial use doctest to make sure that they actually work. Since some code samples behave differently under Linux, Windows, or macOS, t...
curses.ascii— Utilities for ASCII characters...Source code: Lib/curses/ascii.py The curses.ascii module supplies name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants supplied are names for control characters as follows:...
curses— Terminal handling for character-cell displays...[, attr]) Add character ch with attribute attr, and immediately call refresh() on the window. window.enclose(y, x) Test whether the given pair of screen-relative character-cell coordinates are enclosed by the given window, returning Tr...
dataclasses— Data Classes...=False but compare=True would be if a field is expensive to compute a hash value for, that field is needed for equality testing, and there are other fields that contribute to the type’s hash value. Even if a field is excluded from the hash...
decimal— Decimal fixed-point and floating-point arithmetic...y floating point, the result is 5.5511151231257827e-017. While near to zero, the differences prevent reliable equality testing and differences can accumulate. For this reason, decimal is preferred in accounting applications which have stri...
dis— Disassembler for Python bytecode...stack. Used in exception handlers. Added in version 3.11. CHECK_EXC_MATCH Performs exception matching for except. Tests whether the STACK[-2] is an exception matching STACK[-1]. Pops STACK[-1] and pushes the boolean result of the test...
email: Examples...lt).parsestr( 'From: Foo Bar <user@example.com>\n' 'To: <someone_else@example.com>\n' 'Subject: Test message\n' '\n' 'Body would go here\n') # Now the header items can be accessed as a dictionary: p...
fnmatch— Unix filename pattern matching...ex patterns in the following functions: fnmatch(), fnmatchcase(), filter(), filterfalse(). fnmatch.fnmatch(name, pat) Test whether the filename string name matches the pattern string pat, returning True or False. Both parameters are case...
functools— Higher-order functions and operations on callable objects...e race condition in multi-threaded usage. The getter function could run more than once on the same instance, with the latest run setting the cached value. If the cached property is idempotent or otherwise not harmful to run more than once o...
getopt— C-style parser for command line options...-c', 'foo'), ('-d', 'bar')] >>> args ['a1', 'a2'] Using long option names is equally easy: >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' >>> args = s.split() >>> args ['--condition=foo', '--testing', '--output-file',...
heapq— Heap queue algorithm..., 'write code')) >>> heappush(h, (7, 'release product')) >>> heappush(h, (1, 'write spec')) >>> heappush(h, (3, 'create tests')) >>> heappop(h) (1, 'write spec') Other Applications Medians are a measure of central tendency for a set of...
html.parser— Simple HTML and XHTML parser...a(self, data): print("Encountered some data :", data) parser = MyHTMLParser() parser.feed('<html><head><title>Test</title></head>' '<body><h1>Parse me!</h1></body></html>') The output will then be: Encountered a star...
http.server— HTTP servers...the end of the headers, and then the contents of the file are output. For example usage, see the implementation of the test function in Lib/http/server.py. Changed in version 3.7: Support of the 'If-Modified-Since' header. The Simple...
imaplib— IMAP4 protocol client...by passing command to subprocess.Popen(). The following utility functions are defined: imaplib.Internaldate2tuple(datestr) Parse an IMAP4 INTERNALDATE string and return corresponding local time. The return value is a time.struct_time t...
importlib.metadata– Accessing package metadata...To get the full set of requirements for a Distribution Package, use the requires() function: >>> requires('wheel') ["pytest (>=3.0.0) ; extra == 'test'", "pytest-cov ; extra == 'test'"] Mapping import to distribution packages importl...
importlib— The implementation ofimport...can be used to the module’s advantage if it maintains a global table or cache of objects — with a try statement it can test for the table’s presence and skip its initialization if desired: try: cache except NameError: cache = {}...
inspect— Inspect live objects...routinefunction(). When possible, using an async def function is preferred. Also acceptable is calling the function and testing the return with iscoroutine(). Added in version 3.12. inspect.iscoroutine(object) Return True if the objec...
ipaddress— IPv4/IPv6 manipulation library...served for site-local usage. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. ipv4_mapped For addresses tha...
itertools— Functions creating iterators for efficient looping...) elem [,n] elem, elem, elem, … endlessly or up to n times repeat(10, 3) → 10 10 10 Iterators terminating on the shortest input sequence: Iterator Arguments Results Example accumulate() p [,func] p0, p0+p1, p0+p1+p2, … accumulate([1...
json— JSON encoder and decoder...ort_keys is true (default: False), then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer or s...
locale— Internationalization services...the behavior in the way described above. To maintain compatibility with other platforms, not only the LANG variable is tested, but a list of variables given as envvars parameter. The first found to be defined will be used. envvars defaul...
logging.handlers— Logging handlers...imply renamed to the destination. Parameters: source – The source filename. This is normally the base filename, e.g. ‘test.log’. dest – The destination filename. This is normally what the source is rotated to, e.g. ‘test.log.1’. Added...
math— Mathematical functions...ways to choose k items from n items without repetition and without order factorial(n) n factorial gcd(*integers) Greatest common divisor of the integer arguments isqrt(n) Integer square root of a nonnegative integer n lcm(*integers) Le...
multiprocessing— Process-based parallelism...upport() Add support for when a program which uses multiprocessing has been frozen to produce an executable. (Has been tested with py2exe, PyInstaller and cx_Freeze.) One needs to call this function straight after the if __name__ == '__mai...
operator— Standard operators as functions...mation about rich comparisons. The logical operations are also generally applicable to all objects, and support truth tests, identity tests, and boolean operations: operator.not_(obj) operator.__not__(obj) Return the outcome of not obj...
optparse— Parser for command line options...st entirely for backwards compatibility reasons. However, it also serves a niche use case as a tool for prototyping and testing command line argument handling in getopt-based C applications. optparse should be considered as an alternative t...
os— Miscellaneous operating system interfaces...f the file descriptor fd is open and connected to a tty(-like) device, else False. os.lockf(fd, cmd, len, /) Apply, test or remove a POSIX lock on an open file descriptor. fd is an open file descriptor. cmd specifies the command to use...
pathlib— Object-oriented filesystem paths...__'), PosixPath('build')] Listing Python source files in this directory tree: >>> list(p.glob('**/*.py')) [PosixPath('test_pathlib.py'), PosixPath('setup.py'), PosixPath('pathlib.py'), PosixPath('docs/conf.py'), PosixPath('build/lib/pat...
poplib— POP3 protocol client...message’s seen flag; unfortunately, TOP is poorly specified in the RFCs and is frequently broken in off-brand servers. Test this method by hand against the POP3 servers you will use before trusting it. POP3.uidl(which=None) Return mess...
pty— Pseudo-terminal utilities...inal programmatically. Availability: Unix. Pseudo-terminal handling is highly platform dependent. This code is mainly tested on Linux, FreeBSD, and macOS (it is supposed to work on other POSIX platforms but it’s not been thoroughly tested...
random— Generate pseudo-random numbers.... The underlying implementation in C is both fast and threadsafe. The Mersenne Twister is one of the most extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purpo...
re— Regular expression operations...t to right. When one pattern completely matches, that branch is accepted. This means that once A matches, B will not be tested further, even if it would produce a longer overall match. In other words, the '|' operator is never greedy. To...
smtplib— SMTP protocol client...it should not be necessary to call this method explicitly. It is used to implement other methods and may be useful for testing private extensions. If the connection to the server is lost while waiting for the reply, SMTPServerDisconnected...
sqlite3— DB-API 2.0 interface for SQLite databases...converter function using the first word of the declared type as the converter dictionary key. For example: CREATE TABLE test( i integer primary key, ! will look up a converter named "integer" p point, ! will look up a...
stat— Interpretingstat()results...ed in version 3.4: The stat module is backed by a C implementation. The stat module defines the following functions to test for specific file types: stat.S_ISDIR(mode) Return non-zero if the mode is from a directory. stat.S_ISCHR(mod...
statistics— Mathematical statistics functions...rrent algorithm has an early-out when it encounters a zero in the input. This means that the subsequent inputs are not tested for validity. (This behavior may change in the future.) Added in version 3.6. Changed in version 3.10: Added...
symtable— Access to the compiler’s symbol tables...ss ... ... @classmethod ... async def h(cls): pass ... ... global outer ... def outer(self): pass ... ''', 'test', 'exec') >>> class_A = st.get_children()[2] >>> class_A.get_methods() ('f', 'g', 'h') Although A().f() raises Ty...
sys— System-specific parameters and functions...his is guaranteed to increase with each version, including proper support for non-production releases. For example, to test that the Python interpreter is at least version 1.5.2, use: if sys.hexversion >= 0x010502F0: # use some advance...
tarfile— Read and write tar archive files...<tarfile> [<output_dir>] Extract tarfile into the current directory if output_dir is not specified. -t <tarfile> --test <tarfile> Test whether the tarfile is valid or not. -v, --verbose Verbose output. --filter <filtername> Spe...
textwrap— Text wrapping and filling...g only whitespace are ignored in the input and normalized to a single newline character in the output. For example: def test(): # end first line with \ to avoid the empty line! s = '''\ hello world ''' print(repr(s...
threading— Thread-based parallelism...alive when its run() method terminates – either normally, or by raising an unhandled exception. The is_alive() method tests whether the thread is alive. Other threads can call a thread’s join() method. This blocks the calling thread unti...
timeit— Measure execution time of small code snippets...lly the time the statement body took on average within the best repetition of the timing loop. That is, the time the fastest repetition took divided by the loop count. >>> import timeit >>> timeit.timeit('char in text', setup='text = "sampl...
tkinter.ttk— Tk themed widgets...look and feel. As discussed above, there are differences in how the styling is coded. Tk code: l1 = tkinter.Label(text="Test", fg="black", bg="white") l2 = tkinter.Label(text="Test", fg="black", bg="white") Ttk code: style = ttk.Style() s...
tracemalloc— Trace memory allocations...statistics('lineno') print("[ Top 10 ]") for stat in top_stats[:10]: print(stat) Example of output of the Python test suite: [ Top 10 ] <frozen importlib._bootstrap>:716: size=4855 KiB, count=39328, average=126 B <frozen importlib._b...
typing— Support for type hints...t): # Do some complex type-narrowing logic, # after which we hope the inferred type will be `int` ... # Test whether the type checker correctly understands our function assert_type(arg, int) Added in version 3.11....
unittest.mock— mock object libraryunittest.mock — mock object library Added in version 3.3. Source code: Lib/unittest/mock.py unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and...
urllib.request— Extensible library for opening URLs...on installation supports SSL. >>> import urllib.request >>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi', ... data=b'This data is passed to stdin of the CGI') >>> with urllib.request.urlopen(re...
weakref— Weak references...sh() is called the first time only after the object was deleted, the call will raise TypeError. Weak references support tests for equality, but not ordering. If the referents are still alive, two references have the same equality relations...
wsgiref— WSGI Utilities and Reference Implementation...etween URIs ending in /x from ones ending in /x/ when using this routine to do object traversal. wsgiref.util.setup_testing_defaults(environ) Update environ with trivial defaults for testing purposes. This routine adds various parameter...
xml.etree.ElementTree— The ElementTree XML API...ial element that will be serialized as an XML comment by the standard serializer. The comment string can be either a bytestring or a Unicode string. text is a string containing the comment string. Returns an element instance representing...
xmlrpc.client— XML-RPC client access...date/time values. Changed in version 3.3: The use_builtin_types flag was added. Example of Client Usage # simple test program (from the XML-RPC specification) from xmlrpc.client import ServerProxy, Error # server = ServerProxy("http...
zipfile— Work with ZIP archives...hive) Resolve the date_time, compression attributes, and external attributes to suitable defaults as used by ZipFile.writestr(). Returns self for chaining. Added in version 3.14. zipfile.is_zipfile(filename) Returns True if filename...
zoneinfo— IANA time zone support...e using the reset_tzpath() function. This is generally not an advisable operation, though it is reasonable to use it in test functions that require the use of a specific time zone path (or require disabling access to the system time zones)....
- 1. Command line and environment
...nsitive. The category field matches the warning category (ex: DeprecationWarning). This must be a class name; the match test whether the actual warning category of the message is a subclass of the specified warning category. The module fiel...
- 1. Extending Python with C or C++
...xception and its associated value. You don’t need to Py_INCREF() the objects passed to any of these functions. You can test non-destructively whether an exception has been set with PyErr_Occurred(). This returns the current exception obje...
- 1. Introduction
...va applications, or can be used to create applications using the Java class libraries. It is also often used to create tests for Java libraries. More information can be found at the Jython website. Python for .NETThis implementation actua...
- 1. Whetting Your Appetite
...rofessional software developer, you may have to work with several C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is too slow. Perhaps you’re writing a test suite for such a library and find writing the testing...
- 10. Brief Tour of the Standard Library
...expressions offer succinct, optimized solutions: >>> import re >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') ['foot', 'fell', 'fastest'] >>> re.sub(r'(\b[a-z]+) \1', r'\1', 'cat in the the hat') 'cat in the hat' When onl...
- 11. Brief Tour of the Standard Library — Part II
...epresent decimal quantities. Exact representation enables the Decimal class to perform modulo calculations and equality tests that are unsuitable for binary floating point: >>> Decimal('1.00') % Decimal('.10') Decimal('0.00') >>> 1.00 % 0.1...
- 3. An Informal Introduction to Python
...a string or list value, in fact any sequence; anything with a non-zero length is true, empty sequences are false. The test used in the example is a simple comparison. The standard comparison operators are written the same as in C: < (les...
- 3. Data model
...e implementation used, so should not be relied upon, but is something to be aware of when making use of object identity tests. However, after c = []; d = [], c and d are guaranteed to refer to two different, unique, newly created empty list...
- 4. More Control Flow Tools
...: ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!') This example also introduces the in keyword. This tests whether or not a sequence contains a certain value. The default values are evaluated at the point of function defi...
- 4. Using Python on Windows
...installed the Python Install Manager, the global python command can be used from any terminal to launch your current latest version of Python. This version may change over time as you add or remove different versions, and the py list comma...
- 5. Data Structures
...udes a data type for sets. A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, d...
- 5. Using Python on macOS
...ilt versions of Python and many packages for older versions of macOS. Note that distributions might not include the latest versions of Python or other libraries, and are not maintained or supported by the core Python team. 5.3. Installi...
- 6. Modules
...ion. Therefore, if you change your modules, you must restart the interpreter – or, if it’s just one module you want to test interactively, use importlib.reload(), e.g. import importlib; importlib.reload(modulename). 6.1.1. Executing modu...
- 6. Using Python on Android
...e Kivy project Chaquopy pyqtdeploy Termux If you’re sure you want to do all of this manually, read on. You can use the testbed app as a guide; each step below contains a link to the relevant file. First, acquire a build of Python for Andr...
- 7. Input and Output
...e(string) writes the contents of string to the file, returning the number of characters written. >>> f.write('This is a test\n') 15 Other types of objects need to be converted – either to a string (in text mode) or a bytes object (in bina...
- 8. Compound statements
...e following is illegal, mostly because it wouldn’t be clear to which if clause a following else clause would belong: if test1: if test2: print(x) Also note that the semicolon binds tighter than the colon in this context, so that in the fo...
- 8. Errors and Exceptions
...lly be ones that have already been raised and caught by the program, along the following pattern: >>> excs = [] ... for test in tests: ... try: ... test.run() ... except Exception as e: ... excs.append(e) ... >>> if...
- 9. Classes
...ng how to reference the different scopes and namespaces, and how global and nonlocal affect variable binding: def scope_test(): def do_local(): spam = "local spam" def do_nonlocal(): nonlocal spam spam = "no...
- An introduction to the ipaddress module
...1] IPv6Address('2001:db8::ffff:ffff') It also means that network objects lend themselves to using the list membership test syntax like this: if address in network: # do something Containment testing is done efficiently based on the...
- Argparse Tutorial
...d, the relevant variable, in this case args.verbosity, is given None as a value, which is the reason it fails the truth test of the if statement. The help message is a bit different. When using the --verbosity option, one must also specify...
- Built-in Exceptions
...passed as arguments to the exception class’s constructor. User code can raise built-in exceptions. This can be used to test an exception handler or to report an error condition “just like” the situation in which the interpreter raises the...
- Built-in Functions
...object=False, /) Return a Boolean value, i.e. one of True or False. The argument is converted using the standard truth testing procedure. If the argument is false or omitted, this returns False; otherwise, it returns True. The bool class...
- C API Stability
...not hidden when Py_LIMITED_API is defined, even though they’re part of the Limited API. For these reasons, we recommend testing an extension with all minor Python versions it supports, and preferably to build with the lowest such version. W...
- Call Graph Introspection
...s omitted or None, the function will print to sys.stdout. Example: The following Python code: import asyncio async def test(): asyncio.print_call_graph() async def main(): async with asyncio.TaskGroup() as g: g.create_task...
- collections.abc.ByteString.index (Python method, in
collections.abc— Abstract Base Classes for Containers) - Common Object Structures
...jects, the same as object in Python. int Py_Is(PyObject *x, PyObject *y) Part of the Stable ABI since version 3.10.Test if the x object is the y object, the same as x is y in Python. Added in version 3.10. int Py_IsNone(PyObject...
- Curses Programming with Python
...r in color. They’ll be explained in more detail in the next subsection. The addstr() method takes a Python string or bytestring as the value to be displayed. The contents of bytestrings are sent to the terminal as-is. Strings are encoded...
- Debugging C API extensions and CPython Internals with GDB
...mString (v= {'Yuck': <type at remote 0xad4730>, '__builtins__': <module at remote 0x7ffff7fd5ee8>, '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': <Yuck(i=0) at remote 0xaacd80>, 'dict': {0: 0, 1: 1, 2: 2,...
- Defining extension modules
...of this document. One suitable tool is Setuptools, whose documentation can be found at https://setuptools.pypa.io/en/latest/setuptools.html. Normally, the initialization function returns a module definition initialized using PyModuleDef_I...
- Deprecations
...en deprecated since Python 3.13. This function is only useful for Jython support, has a confusing API, and is largely untested. sysconfig: The check_home argument of sysconfig.is_python_build() has been deprecated since Python 3.12. th...
- Descriptor Guide
...te(self, value): pass Custom validators need to inherit from Validator and must supply a validate() method to test various restrictions as needed. Custom validators Here are three practical data validation utilities: OneOf veri...
- Design and History FAQ
...r, and MutableMapping. For Python, many of the advantages of interface specifications can be obtained by an appropriate test discipline for components. A good test suite for a module can both provide a regression test and serve as a module...
- Developing with asyncio
...he coroutine is not scheduled with asyncio.create_task(), asyncio will emit a RuntimeWarning: import asyncio async def test(): print("never scheduled") async def main(): test() asyncio.run(main()) Output: test.py:7: RuntimeWarn...
- Development Tools
...ware. For example, the pydoc module takes a module and generates documentation based on the module’s contents. The doctest and unittest modules contains frameworks for writing unit tests that automatically exercise code and verify that th...
- doctest.--fail-fast (program option, in
doctest— Test interactive Python examples) - doctest.--option (program option, in
doctest— Test interactive Python examples) - doctest.--verbose (program option, in
doctest— Test interactive Python examples) - doctest.-f (program option, in
doctest— Test interactive Python examples) - doctest.-o (program option, in
doctest— Test interactive Python examples) - doctest.-v (program option, in
doctest— Test interactive Python examples) - doctest.COMPARISON_FLAGS (Python data, in
doctest— Test interactive Python examples) - doctest.debug (Python function, in
doctest— Test interactive Python examples) - doctest.debug_src (Python function, in
doctest— Test interactive Python examples) - doctest.DebugRunner (Python class, in
doctest— Test interactive Python examples) - doctest.DocFileSuite (Python function, in
doctest— Test interactive Python examples) - doctest.DocTest.docstring (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTest.examples (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTest.filename (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTest.globs (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTest.lineno (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTest.name (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTestFailure.example (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTestFailure.got (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTestFinder.find (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestParser.get_examples (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestParser.parse (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.failures (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.report_failure (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.report_start (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.report_success (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.report_unexpected_exception (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.run (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.skips (Python attribute, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.summarize (Python method, in
doctest— Test interactive Python examples) - doctest.DocTestRunner.tries (Python attribute, in
doctest— Test interactive Python examples) - doctest.DONT_ACCEPT_BLANKLINE (Python data, in
doctest— Test interactive Python examples) - doctest.DONT_ACCEPT_TRUE_FOR_1 (Python data, in
doctest— Test interactive Python examples) - doctest.ELLIPSIS (Python data, in
doctest— Test interactive Python examples) - doctest.Example (Python class, in
doctest— Test interactive Python examples) - doctest.Example.exc_msg (Python attribute, in
doctest— Test interactive Python examples) - doctest.Example.indent (Python attribute, in
doctest— Test interactive Python examples) - doctest.Example.lineno (Python attribute, in
doctest— Test interactive Python examples) - doctest.Example.options (Python attribute, in
doctest— Test interactive Python examples) - doctest.Example.source (Python attribute, in
doctest— Test interactive Python examples) - doctest.Example.want (Python attribute, in
doctest— Test interactive Python examples) - doctest.FAIL_FAST (Python data, in
doctest— Test interactive Python examples) - doctest.IGNORE_EXCEPTION_DETAIL (Python data, in
doctest— Test interactive Python examples) - doctest.NORMALIZE_WHITESPACE (Python data, in
doctest— Test interactive Python examples) - doctest.OutputChecker (Python class, in
doctest— Test interactive Python examples) - doctest.OutputChecker.check_output (Python method, in
doctest— Test interactive Python examples) - doctest.OutputChecker.output_difference (Python method, in
doctest— Test interactive Python examples) - doctest.register_optionflag (Python function, in
doctest— Test interactive Python examples) - doctest.REPORT_CDIFF (Python data, in
doctest— Test interactive Python examples) - doctest.REPORT_NDIFF (Python data, in
doctest— Test interactive Python examples) - doctest.REPORT_ONLY_FIRST_FAILURE (Python data, in
doctest— Test interactive Python examples) - doctest.REPORT_UDIFF (Python data, in
doctest— Test interactive Python examples) - doctest.REPORTING_FLAGS (Python data, in
doctest— Test interactive Python examples) - doctest.run_docstring_examples (Python function, in
doctest— Test interactive Python examples) - doctest.script_from_examples (Python function, in
doctest— Test interactive Python examples) - doctest.SKIP (Python data, in
doctest— Test interactive Python examples) - doctest.TestResults.attempted (Python attribute, in
doctest— Test interactive Python examples) - doctest.TestResults.failed (Python attribute, in
doctest— Test interactive Python examples) - doctest.TestResults.skipped (Python attribute, in
doctest— Test interactive Python examples) - doctest.UnexpectedException (Python exception, in
doctest— Test interactive Python examples) - doctest.UnexpectedException.example (Python attribute, in
doctest— Test interactive Python examples) - doctest.UnexpectedException.exc_info (Python attribute, in
doctest— Test interactive Python examples) - Enum HOWTO
...LUE # problem is here: they should not be equal True Pickling Enumerations can be pickled and unpickled: >>> from test.test_enum import Fruit >>> from pickle import dumps, loads >>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO)) True Th...
- Exception Handling
...Querying the error indicator PyObject *PyErr_Occurred() Return value: Borrowed reference. Part of the Stable ABI.Test whether the error indicator is set. If set, return the exception type (the first argument to the last call to one...
- Extending/Embedding FAQ
...its value and its length. Note that Python bytes objects may contain null bytes so C’s strlen() should not be used. To test the type of an object, first make sure it isn’t NULL, and then use PyBytes_Check(), PyTuple_Check(), PyList_Check()...
- Futures
...loop=None) Return: obj argument as is, if obj is a Future, a Task, or a Future-like object (isfuture() is used for the test.) a Task object wrapping obj, if obj is a coroutine (iscoroutine() is used for the test); in this case the coroutin...
- Glossary
...order of increasing indexes starting from zero. In multidimensional C-contiguous arrays, the last index varies the fastest when visiting items in order of memory address. However, in Fortran contiguous arrays, the first index varies the...
- HOWTO Fetch Internet Resources Using The urllib Package
...tch localhost URLs through this proxy it blocks them. IE is set to use the proxy, which urllib picks up on. In order to test scripts with a localhost server, I have to prevent urllib from using the proxy. [6] urllib opener for SSL proxy (...
- IDLE — Python editor and shell
...thon DocsAccess local Python documentation, if installed, or start a web browser and open docs.python.org showing the latest Python documentation. Turtle DemoRun the turtledemo module with example Python code and turtle drawings. Additio...
- Instrumenting CPython with DTrace and SystemTap
...(-1), funcname, filename, lineno); } It can be invoked like this: $ stap \ show-call-hierarchy.stp \ -c "./python test.py" The output looks like this: 11408 python(8274): => __contains__ in Lib/_abcoll.py:362 11414 python(827...
- Introduction
...n error. Very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with PyErr_Occurred(). These exceptions are always explicitly documented. Exception state is maintai...
- Isolating Extension Modules
...ve. Extension authors tend to not keep multiple interpreters in mind when developing, and it is currently cumbersome to test the behavior. Enter Per-Module State Instead of focusing on per-interpreter state, Python’s C API is evolving to b...
- Logging Cookbook
...amed fh. The ability to create new handlers with higher- or lower-severity filters can be very helpful when writing and testing an application. Instead of using many print statements for debugging, use logger.debug: Unlike the print statem...
- Logging HOWTO
...their application: if you add handlers ‘under the hood’, you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements. Logging Levels The numeric values of logging levels are given...
- Parsing arguments and building values
...icode_FSConverter() and PyUnicode_FSDecoder(). Changed in version 3.1: Py_CLEANUP_SUPPORTED was added. p (bool) [int]Tests the value passed in for truth (a boolean predicate) and converts the result to its equivalent C true/false integer...
- Pending removal in future versions
...ss, a compatibility shim will be provided until at least Python 3.17. (Contributed by Jelle Zijlstra in gh-105499.) unittest.IsolatedAsyncioTestCase: it is deprecated to return a value that is not None from a test case. urllib.parse depreca...
- Pending removal in Python 3.17
Pending removal in Python 3.17 collections.abc: collections.abc.ByteString is scheduled for removal in Python 3.17. Use isinstance(obj, collections.abc.Buffer) to test if obj implements the buffer protocol at runtime. For...
- PyFile_WriteString.p (C function parameter, in File Objects)
- PyFile_WriteString.s (C function parameter, in File Objects)
- PySys_WriteStderr.format (C function parameter, in Operating System Utilities)
- PySys_WriteStdout.format (C function parameter, in Operating System Utilities)
- Python Documentation contents
...e socket ssl struct symtable sys sys.monitoring sysconfig tarfile threading tkinter turtle types typing unicodedata unittest urllib uuid webbrowser zipfile Optimizations asyncio base64 bdb difflib gc io pathlib pdb textwrap uuid zlib Re...
- Python Initialization Configuration
...d UTF-8 encoded string. See Configuration Options. int PyInitConfig_HasOption(PyInitConfig *config, const char *name) Test if the configuration has an option called name. Return 1 if the option exists, or return 0 otherwise. int PyIni...
- Python Language Services
...ing Symbol Tables Examining Symbol Tables Command-Line Usage token — Constants used with Python parse trees keyword — Testing for Python keywords tokenize — Tokenizer for Python source Tokenizing Input Command-Line Usage Examples tabnan...
- Python Runtime Services
...eria Describing Warning Filters Default Warning Filter Overriding the default filter Temporarily Suppressing Warnings Testing Warnings Updating Code For New Versions of Dependencies Available Functions Available Context Managers Concurren...
- PyUnicodeWriter_WriteStr.obj (C function parameter, in Unicode Objects and Codecs)
- PyUnicodeWriter_WriteStr.writer (C function parameter, in Unicode Objects and Codecs)
- Regular Expression HOWTO
...rs. Matching Characters Most letters and characters will simply match themselves. For example, the regular expression test will match the string test exactly. (You can enable a case-insensitive mode that would let this RE match Test or T...
- Sorting Techniques
...aking comparisons. For example, here’s a case-insensitive string comparison using str.casefold(): >>> sorted("This is a test string from Andrew".split(), key=str.casefold) ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This'] The value...
- test.support.adjust_int_max_str_digits (Python function, in
test— Regression tests package for Python) - test.support.ALWAYS_EQ (Python data, in
test— Regression tests package for Python) - test.support.anticipate_failure (Python function, in
test— Regression tests package for Python) - test.support.args_from_interpreter_flags (Python function, in
test— Regression tests package for Python) - test.support.busy_retry (Python function, in
test— Regression tests package for Python) - test.support.bytecode_helper.BytecodeTestCase.assertInBytecode (Python method, in
test— Regression tests package for Python) - test.support.bytecode_helper.BytecodeTestCase.assertNotInBytecode (Python method, in
test— Regression tests package for Python) - test.support.bytecode_helper.BytecodeTestCase.get_disassembly_as_string (Python method, in
test— Regression tests package for Python) - test.support.calcobjsize (Python function, in
test— Regression tests package for Python) - test.support.calcvobjsize (Python function, in
test— Regression tests package for Python) - test.support.captured_stderr (Python function, in
test— Regression tests package for Python) - test.support.captured_stdin (Python function, in
test— Regression tests package for Python) - test.support.captured_stdout (Python function, in
test— Regression tests package for Python) - test.support.catch_unraisable_exception (Python function, in
test— Regression tests package for Python) - test.support.check__all__ (Python function, in
test— Regression tests package for Python) - test.support.check_disallow_instantiation (Python function, in
test— Regression tests package for Python) - test.support.check_free_after_iterating (Python function, in
test— Regression tests package for Python) - test.support.check_impl_detail (Python function, in
test— Regression tests package for Python) - test.support.check_syntax_error (Python function, in
test— Regression tests package for Python) - test.support.checksizeof (Python function, in
test— Regression tests package for Python) - test.support.cpython_only (Python function, in
test— Regression tests package for Python) - test.support.detect_api_mismatch (Python function, in
test— Regression tests package for Python) - test.support.disable_faulthandler (Python function, in
test— Regression tests package for Python) - test.support.disable_gc (Python function, in
test— Regression tests package for Python) - test.support.findfile (Python function, in
test— Regression tests package for Python) - test.support.flush_std_streams (Python function, in
test— Regression tests package for Python) - test.support.gc_collect (Python function, in
test— Regression tests package for Python) - test.support.get_attribute (Python function, in
test— Regression tests package for Python) - test.support.get_original_stdout (Python function, in
test— Regression tests package for Python) - test.support.get_pagesize (Python function, in
test— Regression tests package for Python) - test.support.get_resource_value (Python function, in
test— Regression tests package for Python) - test.support.HAVE_DOCSTRINGS (Python data, in
test— Regression tests package for Python) - test.support.impl_detail (Python function, in
test— Regression tests package for Python) - test.support.import_helper.CleanImport (Python class, in
test— Regression tests package for Python) - test.support.import_helper.DirsOnSysPath (Python class, in
test— Regression tests package for Python) - test.support.import_helper.forget (Python function, in
test— Regression tests package for Python) - test.support.import_helper.import_fresh_module (Python function, in
test— Regression tests package for Python) - test.support.import_helper.import_module (Python function, in
test— Regression tests package for Python) - test.support.import_helper.make_legacy_pyc (Python function, in
test— Regression tests package for Python) - test.support.import_helper.modules_cleanup (Python function, in
test— Regression tests package for Python) - test.support.import_helper.modules_setup (Python function, in
test— Regression tests package for Python) - test.support.import_helper.unload (Python function, in
test— Regression tests package for Python) - test.support.INTERNET_TIMEOUT (Python data, in
test— Regression tests package for Python) - test.support.is_android (Python data, in
test— Regression tests package for Python) - test.support.is_apple (Python data, in
test— Regression tests package for Python) - test.support.is_apple_mobile (Python data, in
test— Regression tests package for Python) - test.support.is_emscripten (Python data, in
test— Regression tests package for Python) - test.support.is_jython (Python data, in
test— Regression tests package for Python) - test.support.is_resource_enabled (Python function, in
test— Regression tests package for Python) - test.support.is_wasi (Python data, in
test— Regression tests package for Python) - test.support.LARGEST (Python data, in
test— Regression tests package for Python) - test.support.linked_to_musl (Python function, in
test— Regression tests package for Python) - test.support.LONG_TIMEOUT (Python data, in
test— Regression tests package for Python) - test.support.LOOPBACK_TIMEOUT (Python data, in
test— Regression tests package for Python) - test.support.Matcher (Python class, in
test— Regression tests package for Python) - test.support.Matcher.match_value (Python method, in
test— Regression tests package for Python) - test.support.Matcher.matches (Python method, in
test— Regression tests package for Python) - test.support.max_memuse (Python data, in
test— Regression tests package for Python) - test.support.MAX_Py_ssize_t (Python data, in
test— Regression tests package for Python) - test.support.MISSING_C_DOCSTRINGS (Python data, in
test— Regression tests package for Python) - test.support.missing_compiler_executable (Python function, in
test— Regression tests package for Python) - test.support.NEVER_EQ (Python data, in
test— Regression tests package for Python) - test.support.no_tracing (Python function, in
test— Regression tests package for Python) - test.support.open_urlresource (Python function, in
test— Regression tests package for Python) - test.support.optim_args_from_interpreter_flags (Python function, in
test— Regression tests package for Python) - test.support.os_helper.can_symlink (Python function, in
test— Regression tests package for Python) - test.support.os_helper.can_xattr (Python function, in
test— Regression tests package for Python) - test.support.os_helper.change_cwd (Python function, in
test— Regression tests package for Python) - test.support.os_helper.create_empty_file (Python function, in
test— Regression tests package for Python) - test.support.os_helper.EnvironmentVarGuard (Python class, in
test— Regression tests package for Python) - test.support.os_helper.EnvironmentVarGuard.set (Python method, in
test— Regression tests package for Python) - test.support.os_helper.EnvironmentVarGuard.unset (Python method, in
test— Regression tests package for Python) - test.support.os_helper.FakePath (Python class, in
test— Regression tests package for Python) - test.support.os_helper.fd_count (Python function, in
test— Regression tests package for Python) - test.support.os_helper.fs_is_case_insensitive (Python function, in
test— Regression tests package for Python) - test.support.os_helper.FS_NONASCII (Python data, in
test— Regression tests package for Python) - test.support.os_helper.make_bad_fd (Python function, in
test— Regression tests package for Python) - test.support.os_helper.rmdir (Python function, in
test— Regression tests package for Python) - test.support.os_helper.rmtree (Python function, in
test— Regression tests package for Python) - test.support.os_helper.SAVEDCWD (Python data, in
test— Regression tests package for Python) - test.support.os_helper.skip_unless_symlink (Python function, in
test— Regression tests package for Python) - test.support.os_helper.skip_unless_xattr (Python function, in
test— Regression tests package for Python) - test.support.os_helper.temp_cwd (Python function, in
test— Regression tests package for Python) - test.support.os_helper.temp_dir (Python function, in
test— Regression tests package for Python) - test.support.os_helper.temp_umask (Python function, in
test— Regression tests package for Python) - test.support.os_helper.unlink (Python function, in
test— Regression tests package for Python) - test.support.patch (Python function, in
test— Regression tests package for Python) - test.support.PGO (Python data, in
test— Regression tests package for Python) - test.support.PIPE_MAX_SIZE (Python data, in
test— Regression tests package for Python) - test.support.print_warning (Python function, in
test— Regression tests package for Python) - test.support.Py_DEBUG (Python data, in
test— Regression tests package for Python) - test.support.python_is_optimized (Python function, in
test— Regression tests package for Python) - test.support.real_max_memuse (Python data, in
test— Regression tests package for Python) - test.support.reap_children (Python function, in
test— Regression tests package for Python) - test.support.record_original_stdout (Python function, in
test— Regression tests package for Python) - test.support.requires (Python function, in
test— Regression tests package for Python) - test.support.requires_bz2 (Python function, in
test— Regression tests package for Python) - test.support.requires_docstrings (Python function, in
test— Regression tests package for Python) - test.support.requires_freebsd_version (Python function, in
test— Regression tests package for Python) - test.support.requires_gil_enabled (Python function, in
test— Regression tests package for Python) - test.support.requires_gzip (Python function, in
test— Regression tests package for Python) - test.support.requires_IEEE_754 (Python function, in
test— Regression tests package for Python) - test.support.requires_limited_api (Python function, in
test— Regression tests package for Python) - test.support.requires_linux_version (Python function, in
test— Regression tests package for Python) - test.support.requires_lzma (Python function, in
test— Regression tests package for Python) - test.support.requires_mac_version (Python function, in
test— Regression tests package for Python) - test.support.requires_resource (Python function, in
test— Regression tests package for Python) - test.support.requires_zlib (Python function, in
test— Regression tests package for Python) - test.support.ResourceDenied (Python exception, in
test— Regression tests package for Python) - test.support.run_in_subinterp (Python function, in
test— Regression tests package for Python) - test.support.run_with_locale (Python function, in
test— Regression tests package for Python) - test.support.run_with_tz (Python function, in
test— Regression tests package for Python) - test.support.SaveSignals (Python class, in
test— Regression tests package for Python) - test.support.SaveSignals.restore (Python method, in
test— Regression tests package for Python) - test.support.SaveSignals.save (Python method, in
test— Regression tests package for Python) - test.support.script_helper.assert_python_failure (Python function, in
test— Regression tests package for Python) - test.support.script_helper.assert_python_ok (Python function, in
test— Regression tests package for Python) - test.support.script_helper.interpreter_requires_environment (Python function, in
test— Regression tests package for Python) - test.support.script_helper.kill_python (Python function, in
test— Regression tests package for Python) - test.support.script_helper.make_pkg (Python function, in
test— Regression tests package for Python) - test.support.script_helper.make_script (Python function, in
test— Regression tests package for Python) - test.support.script_helper.make_zip_pkg (Python function, in
test— Regression tests package for Python) - test.support.script_helper.make_zip_script (Python function, in
test— Regression tests package for Python) - test.support.script_helper.run_python_until_end (Python function, in
test— Regression tests package for Python) - test.support.script_helper.spawn_python (Python function, in
test— Regression tests package for Python) - test.support.set_memlimit (Python function, in
test— Regression tests package for Python) - test.support.setswitchinterval (Python function, in
test— Regression tests package for Python) - test.support.SHORT_TIMEOUT (Python data, in
test— Regression tests package for Python) - test.support.skip_if_broken_multiprocessing_synchronize (Python function, in
test— Regression tests package for Python) - test.support.sleeping_retry (Python function, in
test— Regression tests package for Python) - test.support.SMALLEST (Python data, in
test— Regression tests package for Python) - test.support.SOCK_MAX_SIZE (Python data, in
test— Regression tests package for Python) - test.support.socket_helper.bind_port (Python function, in
test— Regression tests package for Python) - test.support.socket_helper.bind_unix_socket (Python function, in
test— Regression tests package for Python) - test.support.socket_helper.find_unused_port (Python function, in
test— Regression tests package for Python) - test.support.socket_helper.IPV6_ENABLED (Python data, in
test— Regression tests package for Python) - test.support.socket_helper.skip_unless_bind_unix_socket (Python function, in
test— Regression tests package for Python) - test.support.socket_helper.transient_internet (Python function, in
test— Regression tests package for Python) - test.support.sortdict (Python function, in
test— Regression tests package for Python) - test.support.SuppressCrashReport (Python class, in
test— Regression tests package for Python) - test.support.swap_attr (Python function, in
test— Regression tests package for Python) - test.support.swap_item (Python function, in
test— Regression tests package for Python) - test.support.system_must_validate_cert (Python function, in
test— Regression tests package for Python) - test.support.thread_unsafe (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.catch_threading_exception (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.join_thread (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.reap_threads (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.run_concurrently (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.start_threads (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.threading_cleanup (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.threading_setup (Python function, in
test— Regression tests package for Python) - test.support.threading_helper.wait_threads_exit (Python function, in
test— Regression tests package for Python) - test.support.unix_shell (Python data, in
test— Regression tests package for Python) - test.support.verbose (Python data, in
test— Regression tests package for Python) - test.support.wait_process (Python function, in
test— Regression tests package for Python) - test.support.warnings_helper.check_no_resource_warning (Python function, in
test— Regression tests package for Python) - test.support.warnings_helper.check_syntax_warning (Python function, in
test— Regression tests package for Python) - test.support.warnings_helper.check_warnings (Python function, in
test— Regression tests package for Python) - test.support.warnings_helper.ignore_warnings (Python function, in
test— Regression tests package for Python) - test.support.warnings_helper.WarningsRecorder (Python class, in
test— Regression tests package for Python) - test.support.with_pymalloc (Python function, in
test— Regression tests package for Python) - The
NoneObject...one Object Note that the PyTypeObject for None is not directly exposed in the Python/C API. Since None is a singleton, testing for object identity (using == in C) is sufficient. There is no PyNone_Check() function for the same reason. Py...
- The Python Standard Library
...on availability Built-in Functions Built-in Constants Constants added by the site module Built-in Types Truth Value Testing Boolean Operations — and, or, not Comparisons Numeric Types — int, float, complex Boolean Type - bool Iterator T...
- Tkinter Dialogs
...aster, title=None) A subclass of FileDialog that creates a dialog window for selecting an existing file. ok_command() Test that a file is provided and that the selection indicates an already existing file. class tkinter.filedialog.S...
- Type Objects
...gs. int PyType_IS_GC(PyTypeObject *o) Return true if the type object includes support for the cycle detector; this tests the type flag Py_TPFLAGS_HAVE_GC. int PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) Part of the Stable A...
- Unicode HOWTO
...using Unicode characters in identifiers: répertoire = "/tmp/records.log" with open(répertoire, "w") as f: f.write("test\n") If you can’t enter a particular character in your editor or want to keep the source code ASCII-only for some...
- Unicode Objects and Codecs
...Unicode_Equal() function. int PyUnicode_Equal(PyObject *a, PyObject *b) Part of the Stable ABI since version 3.14.Test if two strings are equal: Return 1 if a is equal to b. Return 0 if a is not equal to b. Set a TypeError exception...
- unittest-discover.--pattern (program option, in
unittest— Unit testing framework) - unittest-discover.--start-directory (program option, in
unittest— Unit testing framework) - unittest-discover.--top-level-directory (program option, in
unittest— Unit testing framework) - unittest-discover.--verbose (program option, in
unittest— Unit testing framework) - unittest-discover.-p (program option, in
unittest— Unit testing framework) - unittest-discover.-s (program option, in
unittest— Unit testing framework) - unittest-discover.-t (program option, in
unittest— Unit testing framework) - unittest-discover.-v (program option, in
unittest— Unit testing framework) - unittest.--buffer (program option, in
unittest— Unit testing framework) - unittest.--catch (program option, in
unittest— Unit testing framework) - unittest.--durations (program option, in
unittest— Unit testing framework) - unittest.--failfast (program option, in
unittest— Unit testing framework) - unittest.--locals (program option, in
unittest— Unit testing framework) - unittest.-b (program option, in
unittest— Unit testing framework) - unittest.-c (program option, in
unittest— Unit testing framework) - unittest.-f (program option, in
unittest— Unit testing framework) - unittest.-k (program option, in
unittest— Unit testing framework) - unittest.addModuleCleanup (Python function, in
unittest— Unit testing framework) - unittest.doModuleCleanups (Python function, in
unittest— Unit testing framework) - unittest.enterModuleContext (Python function, in
unittest— Unit testing framework) - unittest.expectedFailure (Python function, in
unittest— Unit testing framework) - unittest.installHandler (Python function, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.addAsyncCleanup (Python method, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.asyncSetUp (Python method, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.asyncTearDown (Python method, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.enterAsyncContext (Python method, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.loop_factory (Python attribute, in
unittest— Unit testing framework) - unittest.IsolatedAsyncioTestCase.run (Python method, in
unittest— Unit testing framework) - unittest.main (Python function, in
unittest— Unit testing framework) - unittest.mock.ANY (Python data, in
unittest.mock— mock object library) - unittest.mock.AsyncMock (Python class, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_any_await (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_awaited (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_awaited_once (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_awaited_once_with (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_awaited_with (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_has_awaits (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.assert_not_awaited (Python method, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.await_args (Python attribute, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.await_args_list (Python attribute, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.await_count (Python attribute, in
unittest.mock— mock object library) - unittest.mock.AsyncMock.reset_mock (Python method, in
unittest.mock— mock object library) - unittest.mock.call (Python function, in
unittest.mock— mock object library) - unittest.mock.call.call_list (Python method, in
unittest.mock— mock object library) - unittest.mock.create_autospec (Python function, in
unittest.mock— mock object library) - unittest.mock.DEFAULT (Python data, in
unittest.mock— mock object library) - unittest.mock.FILTER_DIR (Python data, in
unittest.mock— mock object library) - unittest.mock.MagicMock (Python class, in
unittest.mock— mock object library) - unittest.mock.Mock (Python class, in
unittest.mock— mock object library) - unittest.mock.Mock.__class__ (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.__dir__ (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock._get_child_mock (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_any_call (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_called (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_called_once (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_called_once_with (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_called_with (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_has_calls (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.assert_not_called (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.attach_mock (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.call_args (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.call_args_list (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.call_count (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.called (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.configure_mock (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.method_calls (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.mock_add_spec (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.mock_calls (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.reset_mock (Python method, in
unittest.mock— mock object library) - unittest.mock.Mock.return_value (Python attribute, in
unittest.mock— mock object library) - unittest.mock.Mock.side_effect (Python attribute, in
unittest.mock— mock object library) - unittest.mock.mock_open (Python function, in
unittest.mock— mock object library) - unittest.mock.NonCallableMagicMock (Python class, in
unittest.mock— mock object library) - unittest.mock.NonCallableMock (Python class, in
unittest.mock— mock object library) - unittest.mock.patch (Python function, in
unittest.mock— mock object library) - unittest.mock.patch.dict (Python function, in
unittest.mock— mock object library) - unittest.mock.patch.multiple (Python function, in
unittest.mock— mock object library) - unittest.mock.patch.object (Python function, in
unittest.mock— mock object library) - unittest.mock.patch.stopall (Python function, in
unittest.mock— mock object library) - unittest.mock.PropertyMock (Python class, in
unittest.mock— mock object library) - unittest.mock.seal (Python function, in
unittest.mock— mock object library) - unittest.mock.sentinel (Python data, in
unittest.mock— mock object library) - unittest.mock.ThreadingMock (Python class, in
unittest.mock— mock object library) - unittest.mock.ThreadingMock.DEFAULT_TIMEOUT (Python attribute, in
unittest.mock— mock object library) - unittest.mock.ThreadingMock.wait_until_any_call_with (Python method, in
unittest.mock— mock object library) - unittest.mock.ThreadingMock.wait_until_called (Python method, in
unittest.mock— mock object library) - unittest.registerResult (Python function, in
unittest— Unit testing framework) - unittest.removeHandler (Python function, in
unittest— Unit testing framework) - unittest.removeResult (Python function, in
unittest— Unit testing framework) - unittest.setUpModule (Python function, in
unittest— Unit testing framework) - unittest.skip (Python function, in
unittest— Unit testing framework) - unittest.skipIf (Python function, in
unittest— Unit testing framework) - unittest.skipUnless (Python function, in
unittest— Unit testing framework) - unittest.tearDownModule (Python function, in
unittest— Unit testing framework) - unittest.TestCase.addClassCleanup (Python method, in
unittest— Unit testing framework) - unittest.TestCase.addCleanup (Python method, in
unittest— Unit testing framework) - unittest.TestCase.addTypeEqualityFunc (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertAlmostEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertCountEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertDictEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertEndsWith (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertFalse (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertGreater (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertGreaterEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertHasAttr (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIn (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIs (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIsInstance (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIsNone (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIsNot (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIsNotNone (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertIsSubclass (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertLess (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertLessEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertListEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertLogs (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertMultiLineEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNoLogs (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotAlmostEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotEndsWith (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotHasAttr (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotIn (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotIsInstance (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotIsSubclass (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotRegex (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertNotStartsWith (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertRaises (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertRaisesRegex (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertRegex (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertSequenceEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertSetEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertStartsWith (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertTrue (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertTupleEqual (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertWarns (Python method, in
unittest— Unit testing framework) - unittest.TestCase.assertWarnsRegex (Python method, in
unittest— Unit testing framework) - unittest.TestCase.debug (Python method, in
unittest— Unit testing framework) - unittest.TestCase.doClassCleanups (Python method, in
unittest— Unit testing framework) - unittest.TestCase.doCleanups (Python method, in
unittest— Unit testing framework) - unittest.TestCase.enterClassContext (Python method, in
unittest— Unit testing framework) - unittest.TestCase.enterContext (Python method, in
unittest— Unit testing framework) - unittest.TestCase.fail (Python method, in
unittest— Unit testing framework) - unittest.TestCase.failureException (Python attribute, in
unittest— Unit testing framework) - unittest.TestCase.id (Python method, in
unittest— Unit testing framework) - unittest.TestCase.longMessage (Python attribute, in
unittest— Unit testing framework) - unittest.TestCase.maxDiff (Python attribute, in
unittest— Unit testing framework) - unittest.TestCase.output (Python attribute, in
unittest— Unit testing framework) - unittest.TestCase.records (Python attribute, in
unittest— Unit testing framework) - unittest.TestCase.run (Python method, in
unittest— Unit testing framework) - unittest.TestCase.setUp (Python method, in
unittest— Unit testing framework) - unittest.TestCase.setUpClass (Python method, in
unittest— Unit testing framework) - unittest.TestCase.shortDescription (Python method, in
unittest— Unit testing framework) - unittest.TestCase.tearDown (Python method, in
unittest— Unit testing framework) - unittest.TestCase.tearDownClass (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.discover (Python method, in
unittest— Unit testing framework) - unittest.TestLoader.errors (Python attribute, in
unittest— Unit testing framework) - unittest.TestLoader.suiteClass (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.addDuration (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addError (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addExpectedFailure (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addFailure (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addSkip (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addSuccess (Python method, in
unittest— Unit testing framework) - unittest.TestResult.addUnexpectedSuccess (Python method, in
unittest— Unit testing framework) - unittest.TestResult.buffer (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.collectedDurations (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.errors (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.expectedFailures (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.failfast (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.failures (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.shouldStop (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.skipped (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.stop (Python method, in
unittest— Unit testing framework) - unittest.TestResult.tb_locals (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.unexpectedSuccesses (Python attribute, in
unittest— Unit testing framework) - unittest.TestResult.wasSuccessful (Python method, in
unittest— Unit testing framework) - unittest.TestSuite.__iter__ (Python method, in
unittest— Unit testing framework) - unittest.TestSuite.debug (Python method, in
unittest— Unit testing framework) - unittest.TestSuite.run (Python method, in
unittest— Unit testing framework) - unittest.TextTestRunner._makeResult (Python method, in
unittest— Unit testing framework) - unittest.TextTestRunner.run (Python method, in
unittest— Unit testing framework) - Weak Reference Objects
...version 3.13, will be removed in version 3.15: Use PyWeakref_GetRef() instead. int PyWeakref_IsDead(PyObject *ref) Test if the weak reference ref is dead. Returns 1 if the reference is dead, 0 if it is alive, and -1 with an error set i...
- What’s New in Python
...odules And APIs New Deprecations CPython Bytecode Changes C API Changes Build Changes Porting to Python 3.13 Regression Test Changes What’s New In Python 3.12 Summary – Release highlights New Features New Features Related to Type Hints Ot...
- What’s New in Python 2.0
...causes the Python compiler to interpret all string literals as Unicode string literals. This is intended to be used in testing and future-proofing your Python code, since some future version of Python may drop support for 8-bit strings and...
- What’s New in Python 2.1
...des a Tk-based interactive help browser. pydoc quickly becomes addictive; try it out! Two different modules for unit testing were added to the standard library. The doctest module, contributed by Tim Peters, provides a testing framework...
- What’s New in Python 2.2
...s C(object): ... __slots__ = ('template', 'name') ... >>> obj = C() >>> print obj.template None >>> obj.template = 'Test' >>> print obj.template Test >>> obj.newattr = None Traceback (most recent call last): File "<stdin>", line 1, in...
- What’s New in Python 2.3
...nd return it. However, for a moderately complicated generator, writing a corresponding class would be much messier. Lib/test/test_generators.py contains a number of more interesting examples. The simplest one implements an in-order travers...
- What’s New in Python 2.4
...re as two new built-in types, set(iterable) and frozenset(iterable). They provide high speed operations for membership testing, for eliminating duplicates from sequences, and for mathematical operations like unions, intersections, differen...
- What’s New in Python 2.5
...lly: final-block The code in block-1 is executed. If the code raises an exception, the various except blocks are tested: if the exception is of class Exception1, handler-1 is executed; otherwise if it’s of class Exception2, handler-2...
- What’s New in Python 2.6
...6, 67]) returns the 12-byte string representing the str() of the list. The primary use of bytes in 2.6 will be to write tests of object type such as isinstance(x, bytes). This will help the 2to3 converter, which can’t tell whether 2.x code...
- What’s New in Python 2.7
...bers and for the Decimal class. There are some useful additions to the standard library, such as a greatly enhanced unittest module, the argparse module for parsing command-line options, convenient OrderedDict and Counter classes in the col...
- What’s New In Python 3.0
...would just be wasteful). If the input sequences are not of equal length, map() will stop at the termination of the shortest of the sequences. For full compatibility with map() from Python 2.x, also wrap the sequences in itertools.zip_longe...
- What’s New In Python 3.1
...(1123, -2) 1100 (Contributed by Mark Dickinson; bpo-4707.) Python now uses David Gay’s algorithm for finding the shortest floating-point representation that doesn’t change its value. This should help mitigate some of the confusion surro...
- What’s New In Python 3.10
...he last case statement. A wildcard can be used in more complex patterns, such as ('error', code, _). For example: match test_variable: case ('warning', code, 40): print("A warning has been received.") case ('error', code, _)...
- What’s New In Python 3.11
...edata The Unicode database has been updated to version 14.0.0. (Contributed by Benjamin Peterson in bpo-45190). unittest Added methods enterContext() and enterClassContext() of class TestCase, method enterAsyncContext() of class Isolat...
- What’s New In Python 3.12
...in the activated virtual environment. The asynchat, asyncore, and imp modules have been removed, along with several unittest.TestCase method aliases. New Features PEP 695: Type Parameter Syntax Generic classes and functions under PEP 48...
- What’s new in Python 3.14
...see the changelog. See also PEP 745 – Python 3.14 release schedule Summary – Release highlights Python 3.14 is the latest stable release of the Python programming language, with a mix of changes to the language, the implementation, and t...
- What’s New In Python 3.2
...e.ArgumentParser( description = 'Manage servers', # main description for help epilog = 'Tested on Solaris and Linux') # displayed after help parser.add_argument('action', # argument name...
- What’s New In Python 3.3
...address (high-level objects representing IP addresses and masks) lzma (compress data using the XZ / LZMA algorithm) unittest.mock (replace parts of your system under test with mock objects) venv (Python virtual environments, as in the popul...
- What’s New In Python 3.4
...included with Python 3.4.0 is pip 1.5.4, and future 3.4.x maintenance releases will update the bundled version to the latest version of pip that is available at the time of creating the release candidate. By default, the commands pipX and p...
- What’s New In Python 3.6
...233329 to debug malloc/realloc. Data at p: 1a 2b 30 00 Memory block allocated at (most recent call first): File "test/test_bytes.py", line 323 File "unittest/case.py", line 600 File "unittest/case.py", line 648 File "unittest/s...
- What’s New In Python 3.7
...recated application configuration settings). DeprecationWarning: displayed by default only in __main__ and when running tests, recommended for warnings intended to be seen by other Python developers where a version upgrade may result in cha...
- What’s New In Python 3.8
...ed <= 10)") A similar benefit arises during regular expression matching where match objects are needed twice, once to test whether a match occurred and another to extract a subgroup: discount = 0.0 if (mo := re.search(r'(\d+)% discount',...
- What’s New In Python 3.9
...g collections.Mapping instead of collections.abc.Mapping emits a DeprecationWarning since Python 3.3, released in 2012. Test your application with the -W default command-line option to see DeprecationWarning and PendingDeprecationWarning, o...
test— Regression tests package for Pythontest — Regression tests package for Python Note The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s standard library is...
- 6. Expressions
- 6. Expressions
...The operator not in is defined to have the inverse truth value of in.
tarfile— Read and write tar archive files--test <tarfile>
zipfile— Work with ZIP archives--test <zipfile>
doctest— Test interactive Python examplesdoctest — Test interactive Python examples Source code: Lib/doctest.py The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown....
unittest— Unit testing frameworkunittest — Unit testing framework Source code: Lib/unittest/__init__.py (If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.) The unittest unit testing framework was origin...
unittest— Unit testing frameworkunittest — Unit testing framework Source code: Lib/unittest/__init__.py (If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.) The unittest unit testing fram...