Skip to content

Commit 6ec00e5

Browse files
author
Erlend Egeberg Aasland
committed
bpo-43988: Document test.support.check_disallow_instantiation() (pythonGH-26394)
1 parent 9122e87 commit 6ec00e5

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Doc/library/test.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,16 @@ The :mod:`test.support` module defines the following functions:
928928
.. versionadded:: 3.10
929929

930930

931+
.. function:: check_disallow_instantiation(test_case, tp, *args, **kwds)
932+
933+
Assert that type *tp* cannot be instantiated using *args* and *kwds*.
934+
935+
.. versionadded:: 3.11
936+
937+
931938
The :mod:`test.support` module defines the following classes:
932939

940+
933941
.. class:: SuppressCrashReport()
934942

935943
A context manager used to try to prevent crash dialog popups on tests that

Lib/test/support/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,9 +1997,9 @@ def infinite_recursion(max_depth=75):
19971997

19981998
def check_disallow_instantiation(testcase, tp, *args, **kwds):
19991999
"""
2000-
Helper for testing types with the Py_TPFLAGS_DISALLOW_INSTANTIATION flag.
2000+
Check that given type cannot be instantiated using *args and **kwds.
20012001
2002-
See bpo-43916.
2002+
See bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag.
20032003
"""
20042004
msg = f"cannot create '{tp.__module__}\.{tp.__name__}' instances"
20052005
testcase.assertRaisesRegex(TypeError, msg, tp, *args, **kwds)

0 commit comments

Comments
 (0)