repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
beartype/beartype | from beartype_test._util.mark.pytskip import skip_unless_godmode
@skip_unless_godmode()
def test_wrapper_fail_obj_large() -> None:
'''
Test unsuccessful usage of a wrapper function dynamically generated by the
:func:`beartype.decorator` decorator to type-check a function accepting a
deeply nested data ... | TIME_MAX | assert | variable | beartype_test/a00_unit/a60_decor/test_decorgodmode.py | test_wrapper_fail_obj_large | 97 | null | |
beartype/beartype | def test_typingpep544_superclass() -> None:
'''
Test the public :class:`beartype.typing.Protocol` superclass.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.typing import (
Protocol as ProtocolFast,
T... | 'beartype.typing' | assert | string_literal | beartype_test/a00_unit/a30_api/typing/test_typingpep544.py | test_typingpep544_superclass | 81 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_len():
'''
Test the :meth:`beartype.door.TypeHint.__len__` dunder method.
'''
# Defer test-specific imports.
from beartype.door import TypeHint
from beartype.typing import (
Tuple,
Union,
)
... | 0 | assert | numeric_literal | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_len | 340 | null | |
beartype/beartype | def test_uppercase_str_char_first():
'''
Test the :func:`beartype._util.text.utiltextmunge.uppercase_str_char_first`
function.
'''
# Defer test-specific imports.
from beartype._util.text.utiltextmunge import uppercase_str_char_first
from pytest import raises
# Assert this munger return... | "<bear>" | assert | string_literal | beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py | test_uppercase_str_char_first | 32 | null | |
beartype/beartype | def test_is_hint_pep589() -> None:
'''
Test the
:beartype._util.hint.pep.proposal.pep589.is_hint_pep589` tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.hint.pep.proposal.pep589 import is_hint_pep589... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep589.py | test_is_hint_pep589 | 72 | null | |
beartype/beartype | def test_make_hint_pep484604_union() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484604.make_hint_pep484604_union`
factory.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar impo... | int | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484604.py | test_make_hint_pep484604_union | 58 | null | |
beartype/beartype | def test_frozendict() -> None:
'''
Test the :func:`beartype._util.kind.maplike.utilmapfrozen.FrozenDict`
subclass.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import BeartypeKindFrozenDictException
fr... | hash(THE_POET) | assert | func_call | beartype_test/a00_unit/a20_util/kind/map/test_utilmapfrozen.py | test_frozendict | 59 | null | |
beartype/beartype | def test_deprecate_module_attr() -> None:
'''
Test the
:func:`beartype._util.module.utilmoddeprecate.deprecate_module_attr` function.
'''
# ..................{ IMPORTS }..................
# Defer test-specific imports.
from beartype._util.module.utilmoddeprecate i... | 'whose veil' | assert | string_literal | beartype_test/a00_unit/a20_util/module/test_utilmoddeprecate.py | test_deprecate_module_attr | 75 | null | |
beartype/beartype | def test_is_mapping_keys_all() -> None:
'''
Test the
:func:`beartype._util.kind.maplike.utilmaptest.is_mapping_keys_all` tester.
'''
# Defer test-specific imports.
from beartype.roar._roarexc import _BeartypeUtilMappingException
from beartype._util.kind.maplike.utilmaptest import is_mapping... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/kind/map/test_utilmaptest.py | test_is_mapping_keys_all | 72 | null | |
beartype/beartype | def test_is_hint_pep593_beartype() -> None:
'''
Test usage of the private
:mod:`beartype._util.hint.pep.proposal.pep593.is_hint_pep593_beartype`
tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar imp... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py | test_is_hint_pep593_beartype | 67 | null | |
beartype/beartype | def test_cacheunboundedstrong() -> None:
"""
Test successful usage of the
:class:`beartype._util.cache.map.utilmapunbounded.CacheUnboundedStrong` class.
"""
# Defer test-specific imports.
from beartype._util.cache.map.utilmapunbounded import CacheUnboundedStrong
# Initially empty unbounded... | hash(KEY_B) | assert | func_call | beartype_test/a00_unit/a20_util/a20_cache/map/test_utilmapbig.py | test_cacheunboundedstrong | 65 | null | |
beartype/beartype | def test_is_hint_pep604() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484604.is_hint_pep604` tester.
'''
# Defer test-specific imports.
from beartype._util.hint.pep.proposal.pep484604 import is_hint_pep604
# Assert this tester accepts a PEP 604-compliant union.
... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484604.py | test_is_hint_pep604 | 31 | null | |
beartype/beartype | def test_get_func_filename_or_none() -> None:
'''
Test the
:func:`beartype._util.func.utilfuncfile.get_func_filename_or_none` getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.func.utilfunccodeobj impo... | None | assert | none_literal | beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py | test_get_func_filename_or_none | 85 | null | |
beartype/beartype | from pytest import raises
from beartype.roar._roarexc import _BeartypeUtilCacheLruException
def test_lrucachestrong_two_pass() -> None:
"""
Test successful usage of the
:func:`beartype._util.cache.map.utilmaplru.CacheLruStrong` class against an
LRU cache caching at most two key-value pairs.
"""
... | 2 | assert | numeric_literal | beartype_test/a00_unit/a20_util/a20_cache/map/test_utilmaplru.py | test_lrucachestrong_two_pass | 90 | null | |
beartype/beartype | from fastmcp import (
Client,
FastMCP,
)
fastmcp_server = FastMCP('With stride colossal, on from hall to hall;')
fastmcp_client = Client(fastmcp_server)
def with_stride_colossal(on_from_hall_to_hall: str) -> int:
'''
Arbitrary function trivially satisfying FastMCP's runnable protocol by
accepting... | len(TOOL_INPUT) | assert | func_call | beartype_test/a90_func/data/claw/external/fastmcp/data_claw_fastmcp.py | data_claw_fastmcp_main | 119 | null | |
beartype/beartype | def test_callmetadecormin() -> None:
'''
Test the
:func:`beartype._check.metadata.call.callmetadecormin.BeartypeCallDecorMinimalMeta`
dataclass.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype import BeartypeC... | cls_stack | assert | variable | beartype_test/a00_unit/a50_check/a00_metadata/call/test_callmetadecormin.py | test_callmetadecormin | 61 | null | |
beartype/beartype | def test_api_vale_is_pass() -> None:
'''
Test successful usage of the :mod:`beartype.vale.Is` factory.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype import beartype
from beartype._util.func.utilfuncmake import m... | 1 | assert | numeric_literal | beartype_test/a00_unit/a30_api/vale/_is/test_valeis.py | test_api_vale_is_pass | 184 | null | |
beartype/beartype | async def test_decor_noop_unhinted_async() -> None:
'''
Test that the :func:`beartype.beartype` decorator efficiently reduces to a
noop on **unannotated asynchronous callables** (i.e., callables with *no*
annotations declared with the ``async def`` rather than ``def`` keywords).
'''
# Defer tes... | kaela | assert | variable | beartype_test/a00_unit/a60_decor/a00_core/test_decornoop.py | test_decor_noop_unhinted_async | 150 | null | |
beartype/beartype | def test_iter_frames() -> None:
'''
Test the
:func:`beartype._util.func.utilfuncframe.iter_frames` iterator.
'''
# Defer test-specific imports.
from beartype._util.func.utilfunccodeobj import get_func_code_object
from beartype._util.func.utilfuncframe import iter_frames
# For each stac... | () | assert | collection | beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py | test_iter_frames | 204 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_equals(
door_cases_equality: 'Iterable[Tuple[object, object, bool]]') -> None:
'''
Test the :meth:`beartype.door.TypeHint.__equals__` dunder method.
Parameters
----------
door_cases_equality : Iterable[Tuple[ob... | nonhint | assert | variable | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_equals | 200 | null | |
beartype/beartype | def test_get_hint_pep585_generic_typeargs_packed(hints_pep_meta) -> None:
'''
Test the
:func:`beartype._util.hint.pep.proposal.pep585.get_hint_pep585_generic_typeargs_packed`
function.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.Hi... | () | assert | collection | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep585.py | test_get_hint_pep585_generic_typeargs_packed | 118 | null | |
beartype/beartype | def test_is_func_argless() -> None:
'''
Test the
:func:`beartype._util.func.arg.utilfuncargtest.is_func_argless` tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.func.arg.utilfuncargtest import is_fun... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py | test_is_func_argless | 38 | null | |
beartype/beartype | def test_get_hint_pep695_parameterizable_typeparams() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep695._get_hint_pep695_parameterizable_typeparams`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific impor... | () | assert | collection | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep695.py | test_get_hint_pep695_parameterizable_typeparams | 82 | null | |
beartype/beartype | def test_add_func_scope_types() -> None:
'''
Test the
:func:`beartype._check.code.codescope.add_func_scope_types` adder.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import (
BeartypeDecorHintNonpe... | (Class,) | assert | collection | beartype_test/a00_unit/a50_check/a80_code/test_codescope.py | test_add_func_scope_types | 159 | null | |
beartype/beartype | def test_get_func_code_or_none() -> None:
'''
Test usage of the
:func:`beartype._util.func.utilfunccode.get_func_code_or_none`
function.
'''
# ..................{ IMPORTS }..................
# Defer test-specific imports.
from beartype.roar._roarexc import _Be... | None | assert | none_literal | beartype_test/a00_unit/a20_util/func/test_utilfunccode.py | test_get_func_code_or_none | 47 | null | |
beartype/beartype | def test_get_hint_pep484612646_typearg_packed_name() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484612646.get_hint_pep484612646_typearg_packed_name`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific im... | 'P' | assert | string_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484612646.py | test_get_hint_pep484612646_typearg_packed_name | 45 | null | |
beartype/beartype | def test_iter_frames() -> None:
'''
Test the
:func:`beartype._util.func.utilfuncframe.iter_frames` iterator.
'''
# Defer test-specific imports.
from beartype._util.func.utilfunccodeobj import get_func_code_object
from beartype._util.func.utilfuncframe import iter_frames
# For each stac... | 'test_iter_frames' | assert | string_literal | beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py | test_iter_frames | 187 | null | |
beartype/beartype | from beartype_test._util.mark.pytskip import skip_if_python_version_less_than
def test_pep484_ref_decor_data() -> None:
'''
Test successful usage of the :func:`beartype.beartype` decorator with
respect to :pep:`484`-compliant stringified forward reference type hints by
importing an external data module... | STOP | assert | variable | beartype_test/a00_unit/a60_decor/a00_core/a60_pep/pep484/forward/test_pep484refdecor.py | test_pep484_ref_decor_data | 117 | null | |
beartype/beartype | def test_add_func_scope_types() -> None:
'''
Test the
:func:`beartype._check.code.codescope.add_func_scope_types` adder.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import (
BeartypeDecorHintNonpe... | types_b | assert | variable | beartype_test/a00_unit/a50_check/a80_code/test_codescope.py | test_add_func_scope_types | 176 | null | |
beartype/beartype | def test_get_hint_pep_sign(hints_pep_meta) -> None:
'''
Test the
:func:`beartype._util.hint.pep.utilpepget.get_hint_pep_sign` getter.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.HintPepMetadata]
List of PEP-compliant type hint ... | hint_pep_meta.pep_sign | assert | complex_expr | beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepsign.py | test_get_hint_pep_sign | 46 | null | |
beartype/beartype | def test_frozendict() -> None:
'''
Test the :func:`beartype._util.kind.maplike.utilmapfrozen.FrozenDict`
subclass.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import BeartypeKindFrozenDictException
fr... | THE_POET | assert | variable | beartype_test/a00_unit/a20_util/kind/map/test_utilmapfrozen.py | test_frozendict | 80 | null | |
beartype/beartype | def test_is_hint_pep544_protocol() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep544.is_hint_pep544_protocol`
tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from abc import abstractmethod
... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep544.py | test_is_hint_pep544_protocol | 106 | null | |
beartype/beartype | from pytest import raises
from beartype.roar._roarexc import _BeartypeUtilCacheLruException
def test_lrucachestrong_one_pass() -> None:
"""
Test successful usage of the
:func:`beartype._util.cache.map.utilmaplru.CacheLruStrong` class against an
LRU cache caching at most one key-value pair.
"""
... | 1 | assert | numeric_literal | beartype_test/a00_unit/a20_util/a20_cache/map/test_utilmaplru.py | test_lrucachestrong_one_pass | 46 | null | |
beartype/beartype | def test_get_name_error_attr_name() -> None:
'''
Test the
:func:`beartype._util.error.utilerrget.get_name_error_attr_name` getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.error.utilerrget import get_... | 'undefined_attr' | assert | string_literal | beartype_test/a00_unit/a20_util/error/test_utilerrget.py | test_get_name_error_attr_name | 39 | null | |
beartype/beartype | def test_decor_noop_hint_ignorable_order() -> None:
'''
Test that the :func:`beartype.beartype` decorator efficiently reduces to a
noop on callables annotated with only ignorable type hints in a manner
specifically exercising non-trivial edge cases with respect to ordering
that would be pragmaticall... | mork | assert | variable | beartype_test/a00_unit/a60_decor/a00_core/test_decornoop.py | test_decor_noop_hint_ignorable_order | 254 | null | |
beartype/beartype | from beartype_test._util.mark.pytskip import skip_unless_package
@skip_unless_package('PyInstaller')
def test_pyinstaller(
monkeypatch: 'pytest.MonkeyPatch', tmp_path: 'pathlib.Path') -> None:
'''
Integration test validating that the :mod:`beartype` package raises *no*
unexpected exceptions when an arb... | '' | assert | string_literal | beartype_test/a90_func/a50_external/test_pyinstaller.py | test_pyinstaller | 159 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
@ignore_warnings(DeprecationWarning)
def test_beartype(capsys: 'pytest.capsys', iter_hints_piths_meta) -> None:
'''
Test the :func:`beartype.beartype` decorator with respect to type-checking
code dynamically generated by the
:mod:`beartype._d... | '_' | assert | string_literal | beartype_test/a00_unit/a60_decor/a20_main/test_beartype.py | test_beartype | 202 | null | |
beartype/beartype | def test_decor_pep557() -> None:
'''
Test :pep:`557` support implemented in the :func:`beartype.beartype`
decorator if the active Python interpreter targets Python >= 3.8 *or* skip
otherwise.
'''
# ..................{ IMPORTS }..................
# Defer test-speci... | 0xBABE | assert | complex_expr | beartype_test/a00_unit/a60_decor/a00_core/a60_pep/test_decorpep557.py | test_decor_pep557 | 165 | null | |
beartype/beartype | def test_get_node_attr_basename_first() -> None:
'''
Test the :func:`beartype._util.ast.utilastget.get_node_attr_basename_first`
factory.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.ast.utilastget import... | 'instead_of_sweets' | assert | string_literal | beartype_test/a00_unit/a20_util/ast/test_utilastget.py | test_get_node_attr_basename_first | 45 | null | |
beartype/beartype | def test_add_func_scope_types() -> None:
'''
Test the
:func:`beartype._check.code.codescope.add_func_scope_types` adder.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import (
BeartypeDecorHintNonpe... | Class | assert | variable | beartype_test/a00_unit/a50_check/a80_code/test_codescope.py | test_add_func_scope_types | 153 | null | |
beartype/beartype | def test_import_module_or_none() -> None:
'''
Test the
:func:`beartype._util.module.utilmodget.import_module_or_none` function.
'''
# Defer test-specific imports.
import beartype
from beartype.roar import BeartypeModuleUnimportableWarning
from beartype._util.module.utilmodimport import ... | beartype | assert | variable | beartype_test/a00_unit/a20_util/module/test_utilmodimport.py | test_import_module_or_none | 34 | null | |
beartype/beartype | def test_api_deprecations() -> None:
'''
Test all deprecated attributes importable from the public APIs of all
subpackages of the :mod:`beartype` package (including itself).
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from ... | None | assert | none_literal | beartype_test/a00_unit/a00_core/test_a00_package.py | test_api_deprecations | 109 | null | |
beartype/beartype | def test_hintsane() -> None:
'''
Test the
:func:`beartype._check.metadata.hint.hintsane.HintSane` dataclass.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._check.metadata.hint.hintsane import (
HINT_SANE... | HintSane(list[str]) | assert | func_call | beartype_test/a00_unit/a50_check/a00_metadata/hint/test_hintsane.py | test_hintsane | 43 | null | |
beartype/beartype | def test_make_hint_pep612_concatenate_list_or_none() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep612.make_hint_pep612_concatenate_list_or_none`
factory.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports... | Concatenate[P] | assert | complex_expr | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep612.py | test_make_hint_pep612_concatenate_list_or_none | 93 | null | |
beartype/beartype | def test_convert_str_version_to_tuple() -> None:
'''
Test the
:func:`beartype._util.text.utiltextversion.convert_str_version_to_tuple`
exception-raiser.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar._ro... | (26,) | assert | collection | beartype_test/a00_unit/a20_util/text/test_utiltextversion.py | test_convert_str_version_to_tuple | 40 | null | |
beartype/beartype | def test_is_func_beartyped() -> None:
'''
Test the
:func:`beartype._util.bear.utilbearfunc.is_func_beartyped` tester.
'''
# Defer test-specific imports.
from beartype import beartype
from beartype._util.bear.utilbearfunc import is_func_beartyped
@beartype
def where_that_or() -> str... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/api/test_utilapibeartype.py | test_is_func_beartyped | 50 | null | |
beartype/beartype | def test_cacheunboundedstrong() -> None:
"""
Test successful usage of the
:class:`beartype._util.cache.map.utilmapunbounded.CacheUnboundedStrong` class.
"""
# Defer test-specific imports.
from beartype._util.cache.map.utilmapunbounded import CacheUnboundedStrong
# Initially empty unbounded... | VALUE_A | assert | variable | beartype_test/a00_unit/a20_util/a20_cache/map/test_utilmapbig.py | test_cacheunboundedstrong | 49 | null | |
beartype/beartype | def test_join_delimited() -> None:
'''
Test the :func:`beartype._util.text.utiltextjoin.join_delimited` function.
'''
# Defer test-specific imports.
from beartype._util.text.utiltextjoin import join_delimited
# Assert that joining a sequence of no strings returns the empty string.
asser | '' | assert | string_literal | beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py | test_join_delimited | 29 | null | |
beartype/beartype | def test_get_hint_pep_args(hints_pep_meta) -> None:
'''
Test the
:func:`beartype._util.hint.pep.utilpepget.get_hint_pep_args`
getter.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.HintPepMetadata]
List of PEP-compliant type h... | () | assert | collection | beartype_test/a00_unit/a20_util/hint/a00_pep/test_a50_utilpepget.py | test_get_hint_pep_args | 73 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
@ignore_warnings(DeprecationWarning)
def test_beartype(capsys: 'pytest.capsys', iter_hints_piths_meta) -> None:
'''
Test the :func:`beartype.beartype` decorator with respect to type-checking
code dynamically generated by the
:mod:`beartype._d... | '' | assert | string_literal | beartype_test/a00_unit/a60_decor/a20_main/test_beartype.py | test_beartype | 294 | null | |
beartype/beartype | def test_get_hint_pep484612646_typearg_packed_name() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484612646.get_hint_pep484612646_typearg_packed_name`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific im... | 'T' | assert | string_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484612646.py | test_get_hint_pep484612646_typearg_packed_name | 41 | null | |
beartype/beartype | def attach_func_locals(**kwargs) -> 'collections.abc.Callable':
'''
Decorator attaching the local scope of the parent callable declaring the
passed callable to a new ``func_locals`` attribute of the passed callable.
Parameters
----------
This decorator forwards all passed keyword parameters as ... | attr | assert | variable | beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py | test_add_func_scope_attr | 295 | null | |
beartype/beartype | def test_decor_noop_unhinted_sync() -> None:
'''
Test that the :func:`beartype.beartype` decorator efficiently reduces to a
noop on **unannotated synchronous callables** (i.e., callables with *no*
annotations declared with the ``def`` rather than ``async def`` keyword).
'''
# Defer test-specifi... | 'WAAAGH!!HGAAAW' | assert | string_literal | beartype_test/a00_unit/a60_decor/a00_core/test_decornoop.py | test_decor_noop_unhinted_sync | 99 | null | |
beartype/beartype | def test_nonpep_pass_param_tuple() -> None:
'''
Test type-checking for a function call successfully passed a parameter
annotated with a PEP-noncompliant tuple union.
'''
# Import this decorator.
from beartype import beartype
# Function to be type-checked. For completeness, test both an act... | 'Carnifex3735928559' | assert | string_literal | beartype_test/a00_unit/a60_decor/a00_core/a40_nonpep/test_codenonpep.py | test_nonpep_pass_param_tuple | 118 | null | |
beartype/beartype | def test_is_python_optimized(monkeypatch: 'pytest.MonkeyPatch') -> None:
'''
Test the :func:`beartype._util.py.utilpyinterpreter.is_python_optimized`
tester.
Parameters
----------
monkeypatch : MonkeyPatch
:mod:`pytest` fixture allowing various state associated with the active
P... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/py/test_utilpyinterpreter.py | test_is_python_optimized | 66 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_len():
'''
Test the :meth:`beartype.door.TypeHint.__len__` dunder method.
'''
# Defer test-specific imports.
from beartype.door import TypeHint
from beartype.typing import (
Tuple,
Union,
)
... | 2 | assert | numeric_literal | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_len | 341 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_equals(
door_cases_equality: 'Iterable[Tuple[object, object, bool]]') -> None:
'''
Test the :meth:`beartype.door.TypeHint.__equals__` dunder method.
Parameters
----------
door_cases_equality : Iterable[Tuple[ob... | IS_EQUAL | assert | variable | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_equals | 190 | null | |
beartype/beartype | def test_get_hint_pep484585_args() -> None:
'''
Test the
:func:`beartype._util.hint.pep.proposal.pep484585.pep484585.get_hint_pep484585_args`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import... | bool | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_pep484585core.py | test_get_hint_pep484585_args | 41 | null | |
beartype/beartype | def test_decor_type_basic() -> None:
'''
Test decoration of user-defined classes by the :func:`beartype.beartype`
decorator from the perspective of basic usability.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype ... | 0 | assert | numeric_literal | beartype_test/a00_unit/a60_decor/a00_core/a00_type/test_decortype_core.py | test_decor_type_basic | 66 | null | |
beartype/beartype | from beartype_test._util.mark.pytskip import skip
@skip('Currently broken due to known issues in decoration-time type-checking.')
def test_decor_arg_kind_flex_optional() -> None:
'''
Test the :func:`beartype.beartype` decorator on a callable passed an
optional flexible parameter whose default value violate... | 1 | assert | numeric_literal | beartype_test/a00_unit/a60_decor/a00_core/test_decorarg.py | test_decor_arg_kind_flex_optional | 129 | null | |
beartype/beartype | from beartype_test._util.mark.pytskip import (
skip_if_pypy,
skip_if_python_version_less_than,
skip_if_python_version_greater_than_or_equal_to,
)
def test_pep563_hint_pep484_namedtuple() -> None:
'''
Test module-scoped :pep:`563` support implemented in the
:func:`beartype.beartype` decorator wi... | 0xCAFEFACE | assert | complex_expr | beartype_test/a00_unit/a60_decor/a00_core/a60_pep/test_decorpep563.py | test_pep563_hint_pep484_namedtuple | 351 | null | |
beartype/beartype | def test_beartypehintable() -> None:
'''
Test the :class:`beartype.plug._plughintable.BeartypeHintable` mixin.
'''
# .....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.plug import BeartypeHintable
from pytest import raises... | str | assert | variable | beartype_test/a00_unit/a30_api/plug/test_plugmixin.py | test_beartypehintable | 50 | null | |
beartype/beartype | def test_get_hint_pep749_subhint() -> None:
'''
Test the pair of private
:mod:`beartype._util.hint.pep.proposal.pep749.get_hint_pep749_subhint_mandatory`
and
:mod:`beartype._util.hint.pep.proposal.pep749.get_hint_pep749_subhint_optional`
getters.
'''
# ....................{ IMPORTS ... | SENTINEL | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep749.py | test_get_hint_pep749_subhint | 118 | null | |
beartype/beartype | def attach_func_locals(**kwargs) -> 'collections.abc.Callable':
'''
Decorator attaching the local scope of the parent callable declaring the
passed callable to a new ``func_locals`` attribute of the passed callable.
Parameters
----------
This decorator forwards all passed keyword parameters as ... | Union[int, str] | assert | complex_expr | beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py | test_get_func_locals | 235 | null | |
beartype/beartype | def test_decor_noop_hint_ignorable_order() -> None:
'''
Test that the :func:`beartype.beartype` decorator efficiently reduces to a
noop on callables annotated with only ignorable type hints in a manner
specifically exercising non-trivial edge cases with respect to ordering
that would be pragmaticall... | gork | assert | variable | beartype_test/a00_unit/a60_decor/a00_core/test_decornoop.py | test_decor_noop_hint_ignorable_order | 253 | null | |
beartype/beartype | def test_is_hint_nonpep(not_hints_nonpep) -> None:
'''
Test the
:func:`beartype._util.hint.nonpep.utilnonpeptest.is_hint_nonpep`
tester.
Parameters
----------
not_hints_nonpep : frozenset
Frozen set of various objects that are *not* PEP-noncompliant type hints
exercising wel... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py | test_is_hint_nonpep | 86 | null | |
beartype/beartype | AND_SEE_THE_GREAT_ACHILLES = 'whom we knew'
def test_make_func(capsys) -> None:
'''
Test the :func:`beartype._util.func.utilfuncmake.make_func` function.
Parameters
----------
capsys
:mod:`pytest` fixture enabling standard output and error to be reliably
captured and tested against... | 2 | assert | numeric_literal | beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py | test_make_func | 138 | null | |
beartype/beartype | def test_nonpep_pass_param_tuple() -> None:
'''
Test type-checking for a function call successfully passed a parameter
annotated with a PEP-noncompliant tuple union.
'''
# Import this decorator.
from beartype import beartype
# Function to be type-checked. For completeness, test both an act... | 'Norn-QueenBehemoth' | assert | string_literal | beartype_test/a00_unit/a60_decor/a00_core/a40_nonpep/test_codenonpep.py | test_nonpep_pass_param_tuple | 117 | null | |
beartype/beartype | from beartype_test._util.mark.pytskip import skip_unless_package
from collections.abc import Iterable
def test_bite_infer_hint_numpy(
bite_cases_infer_hint: 'Iterable[Tuple[object, object]]',
numpy_arrays: 'beartype_test.a00_unit.data.api.data_apinumpy._NumpyArrays',
) -> None:
'''
Test the :func:`bear... | hint | assert | variable | beartype_test/a00_unit/a30_api/bite/test_bite_infer_hint.py | test_bite_infer_hint_numpy | 308 | null | |
beartype/beartype | def test_decor_mypy_notimplemented() -> None:
'''
Test the :func:`beartype.beartype` decorator against :mod:`mypy` compliant
usage of the :data:`NotImplemented` singleton, which is contextually
permissible *only* as an unsubscripted return annotation of binary dunder
methods.
'''
# ........... | the_seas | assert | variable | beartype_test/a00_unit/a60_decor/a00_core/a90_api/external/test_decor_mypy.py | test_decor_mypy_notimplemented | 106 | null | |
beartype/beartype | def test_get_func_filename_or_none() -> None:
'''
Test the
:func:`beartype._util.func.utilfuncfile.get_func_filename_or_none` getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.func.utilfunccodeobj impo... | __file__ | assert | variable | beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py | test_get_func_filename_or_none | 89 | null | |
beartype/beartype | AND_SEE_THE_GREAT_ACHILLES = 'whom we knew'
def test_make_func(capsys) -> None:
'''
Test the :func:`beartype._util.func.utilfuncmake.make_func` function.
Parameters
----------
capsys
:mod:`pytest` fixture enabling standard output and error to be reliably
captured and tested against... | 4 | assert | numeric_literal | beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py | test_make_func | 148 | null | |
beartype/beartype | def unit_test_is_hint_pep695_subbed() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep695.is_hint_pep695_subbed`
tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.hint.pep.p... | 'ItsBurstingBurthen' | assert | string_literal | beartype_test/a00_unit/data/pep/pep695/data_pep695util.py | unit_test_iter_hint_pep695_forwardrefs | 192 | null | |
beartype/beartype | def test_data_indent_level_to_code() -> None:
'''
Test the :obj:`beartype._data.code.datacodeindent.INDENT_LEVEL_TO_CODE`
dictionary singleton.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._data.code.datacodein... | ' ' | assert | string_literal | beartype_test/a00_unit/a10_data/code/test_datacodeindent.py | test_data_indent_level_to_code | 34 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_mapping(iter_hints_piths_meta) -> None:
'''
Test that the :meth:`beartype.door.TypeHint.__new__` factory method
successfully creates and returns an instance of a concrete subclass of the
abstract :class:`beartype.door.T... | hint | assert | variable | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_mapping | 135 | null | |
beartype/beartype | def test_is_hint(hints_pep_meta) -> None:
'''
Test the :func:`beartype._util.hint.utilhinttest.is_hint` tester.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.HintPepMetadata]
List of type hint metadata describing sample type hints ex... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py | test_is_hint | 84 | null | |
beartype/beartype | def test_pack_hint_pep484612646_typearg_unpacked() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484612646.pack_hint_pep484612646_typearg_unpacked`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific import... | T | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484612646.py | test_pack_hint_pep484612646_typearg_unpacked | 83 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
@ignore_warnings(DeprecationWarning)
def test_beartype(capsys: 'pytest.capsys', iter_hints_piths_meta) -> None:
'''
Test the :func:`beartype.beartype` decorator with respect to type-checking
code dynamically generated by the
:mod:`beartype._d... | pith | assert | variable | beartype_test/a00_unit/a60_decor/a20_main/test_beartype.py | test_beartype | 284 | null | |
beartype/beartype | def test_is_identifier() -> None:
'''
Test the :func:`beartype._util.text.utiltextidentifier.is_identifier` tester.
'''
# Defer test-specific imports.
from beartype._util.text.utiltextidentifier import is_identifier
# Assert this tester accepts an unqualified Python identifier prefixed by
... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/text/test_utiltextidentifier.py | test_is_identifier | 63 | null | |
beartype/beartype | def test_data_indent_level_to_code() -> None:
'''
Test the :obj:`beartype._data.code.datacodeindent.INDENT_LEVEL_TO_CODE`
dictionary singleton.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._data.code.datacodein... | ' ' | assert | string_literal | beartype_test/a00_unit/a10_data/code/test_datacodeindent.py | test_data_indent_level_to_code | 36 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_repr() -> None:
'''
Test the :meth:`beartype.door.TypeHint.__repr__` dunder method.
'''
# Defer test-specific imports.
from beartype.door import TypeHint
from beartype.typing import Callable
annotation = C... | repr(hint) | assert | func_call | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_repr | 150 | null | |
beartype/beartype | def test_is_module() -> None:
'''
Test the :func:`beartype._util.module.utilmodtest.is_module` tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import BeartypeModuleUnimportableWarning
from beartype._u... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/module/test_utilmodtest.py | test_is_module | 65 | null | |
beartype/beartype | def test_get_hint_pep593_metahint() -> None:
'''
Test the
:beartype._util.hint.pep.proposal.pep593.get_hint_pep593_metahint`
getter.
'''
# Defer test-specific imports.
from beartype.roar import BeartypeDecorHintPep593Exception
from beartype.typing import (
Annotated,
Opt... | metahint | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep593.py | test_get_hint_pep593_metahint | 126 | null | |
beartype/beartype | def test_reduce_hint_pep484612646_subbed_typeargs_to_hints() -> None:
'''
Test the private
:mod:`beartype._check.convert._reduce._pep.redpep484612646.reduce_hint_pep484612646_subbed_typeargs_to_hints`
reducer.
'''
# ....................{ IMPORTS }....................
... | Generic | assert | variable | beartype_test/a00_unit/a50_check/a40_convert/a00_reduce/pep/test_redpep484612646.py | test_reduce_hint_pep484612646_subbed_typeargs_to_hints | 290 | null | |
beartype/beartype | from beartype_test._util.mark.pytmark import ignore_warnings
def test_door_typehint_new() -> None:
'''
Test the :meth:`beartype.door.TypeHint.__new__` factory method.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.d... | TypeHint(list) | assert | func_call | beartype_test/a00_unit/a30_api/door/a00_type/test_door_typehint.py | test_door_typehint_new | 54 | null | |
beartype/beartype | def test_import_module_attr_or_sentinel() -> None:
'''
Test the
:func:`beartype._util.module.utilmodget.import_module_attr_or_sentinel`
importer.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar import Bea... | str | assert | variable | beartype_test/a00_unit/a20_util/module/test_utilmodimport.py | test_import_module_attr_or_sentinel | 198 | null | |
beartype/beartype | def test_is_hint_pep(hints_pep_meta, hints_nonpep_meta) -> None:
'''
Test the :func:`beartype._util.hint.pep.utilpeptest.is_hint_pep`
tester.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.HintPepMetadata]
List of PEP-compliant ty... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py | test_is_hint_pep | 104 | null | |
beartype/beartype | def test_get_hint_pep612_paramspec() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep612.get_hint_pep612_paramspec`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype._util.api.sta... | P | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep612.py | test_get_hint_pep612_paramspec | 49 | null | |
beartype/beartype | def test_convert_str_version_to_tuple() -> None:
'''
Test the
:func:`beartype._util.text.utiltextversion.convert_str_version_to_tuple`
exception-raiser.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar._ro... | (0,) | assert | collection | beartype_test/a00_unit/a20_util/text/test_utiltextversion.py | test_convert_str_version_to_tuple | 36 | null | |
beartype/beartype | def test_uppercase_str_char_first():
'''
Test the :func:`beartype._util.text.utiltextmunge.uppercase_str_char_first`
function.
'''
# Defer test-specific imports.
from beartype._util.text.utiltextmunge import uppercase_str_char_first
from pytest import raises
# Assert this munger return... | "" | assert | string_literal | beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py | test_uppercase_str_char_first | 33 | null | |
beartype/beartype | def test_get_func_args_len_flexible() -> None:
'''
Test the
:func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar._roarexc impor... | 1 | assert | numeric_literal | beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py | test_get_func_args_len_flexible | 57 | null | |
beartype/beartype | def test_beartype_forward_scope() -> None:
'''
Test the
:class:`beartype._check.forward.scope.fwdscopecls.BeartypeForwardScope`
dictionary subclass.
'''
# ....................{ LOCALS }....................
# Defer test-specific imports.
from beartype.roar import ... | dict | assert | variable | beartype_test/a00_unit/a50_check/a20_forward/a90_scope/test_fwdscopecls.py | test_beartype_forward_scope | 83 | null | |
beartype/beartype | import pytest
from beartype_test._util.mark.pytskip import skip
@pytest.mark.run_in_subprocess
def test_equinox_filter_jit() -> None:
'''
Functional test validating that the :mod:`beartype` package successfully
type-checks callables decorated by the third-party
:func:`equinox.filter_jit` decorator anno... | jax_numpy.array(0.0) | assert | func_call | beartype_test/a90_func/a50_external/a50_jax/test_equinox.py | test_equinox_filter_jit | 138 | null | |
beartype/beartype | from functools import wraps
def test_get_func_codeobj_or_none() -> None:
'''
Test the
:func:`beartype._util.func.utilfunccodeobj.get_func_code_object_or_none`
function.
'''
# ..................{ IMPORTS }..................
# Defer test-specific imports.
from ... | None | assert | none_literal | beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py | test_get_func_codeobj_or_none | 146 | null | |
beartype/beartype | def test_get_func_args_len_flexible() -> None:
'''
Test the
:func:`beartype._util.func.arg.utilfuncarglen.get_func_args_flexible_len`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar._roarexc impor... | 0 | assert | numeric_literal | beartype_test/a00_unit/a20_util/func/arg/test_utilfuncarglen.py | test_get_func_args_len_flexible | 55 | null | |
beartype/beartype | def test_is_hint_pep_subbed(hints_pep_meta, hints_nonpep_meta) -> None:
'''
Test the :func:`beartype._util.hint.pep.utilpeptest.is_hint_pep_subbed`
tester.
Parameters
----------
hints_pep_meta : List[beartype_test.a00_unit.data.hint.metadata.data_hintpithmeta.HintPepMetadata]
List of PE... | hint_pep_meta.is_args | assert | complex_expr | beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py | test_is_hint_pep_subbed | 140 | null | |
beartype/beartype | def test_pack_hint_pep484612646_typearg_unpacked() -> None:
'''
Test the private
:mod:`beartype._util.hint.pep.proposal.pep484612646.pack_hint_pep484612646_typearg_unpacked`
getter.
'''
# ....................{ IMPORTS }....................
# Defer test-specific import... | Ts | assert | variable | beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_pep484612646.py | test_pack_hint_pep484612646_typearg_unpacked | 117 | null | |
beartype/beartype | def test_truncate_str():
'''
Test the :func:`beartype._util.text.utiltextmunge.truncate_str` function.
'''
# Defer test-specific imports.
from beartype._util.text.utiltextmunge import truncate_str
# Assert that truncating the empty string returns the empty string.
assert truncate_str(text=... | 'Sen' | assert | string_literal | beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py | test_truncate_str | 163 | null | |
beartype/beartype | def test_is_type_pep557_dataclass() -> None:
'''
Test the
:func:`beartype._util.cls.pep.clspep557.is_type_pep557_dataclass` tester.
'''
# ....................{ IMPORTS }....................
# Defer test-specific imports.
from beartype.roar._roarexc import BeartypeDeco... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/cls/pep/test_utilpep557.py | test_is_type_pep557_dataclass | 69 | null | |
beartype/beartype | def test_is_func_lambda() -> None:
'''
Test the
:func:`beartype._util.func.utilfunctest.is_func_lambda` tester.
'''
# Defer test-specific imports.
from beartype._util.func.utilfunctest import is_func_lambda
def intimations_of_immortality(): 'from Recollections of Early Childhood'
# As... | True | assert | bool_literal | beartype_test/a00_unit/a20_util/func/test_utilfunctest.py | test_is_func_lambda | 32 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.