Skip to content

Commit

Permalink
beartype.door API tests x 2.
Browse files Browse the repository at this point in the history
This commit is the next in a commit chain repairing currently failing
tests pertaining to the `beartype.door` subpackage, recently implemented
by Harvard microscopist and general genius @tlambert03 in PR #136.
Specifically, this commit:

* Renames `beartype.math` to `beartype.door`. N-n-now... hear me out
  here. I came up with a ludicrous acronym and we're going to have to
  learn to live with it: the **D**ecidedly **O**bject-**O**rientedly
  **R**ecursive (DOOR) API. Or, `beartype.door` for short. Open the door
  to a whole new type-hinting world, everyone.
* Refactored `beartype_test.test_is_subtype` to defer unsafe
  instantiation of non-trivial global variables to test-time via
  `pytest` fixtures.
* Shifted `beartype_test.test_is_subtype` to
  `beartype_test.a00_unit.a60_api.door.test_door` for disambiguity and
  testability.

Since `beartype.door` remains critically broken under both Python 3.7
and 3.8, tests remain disabled until the Typing Doctor gets in.
(*Hazardous hazmats are arduous!*)
  • Loading branch information
leycec committed Jul 8, 2022
1 parent 5c245a6 commit d74a4f0
Show file tree
Hide file tree
Showing 10 changed files with 709 additions and 535 deletions.
10 changes: 9 additions & 1 deletion README.rst
Expand Up @@ -2522,6 +2522,10 @@ Let's chart current and future compliance with Python's `typing`_ landscape:
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| | die_if_unbearable_ | **0.10.0**\ —\ *current* | **0.10.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| beartype.door | TypeHint | **0.11.0**\ —\ *current* | **0.11.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| | is_subhint | **0.10.0**\ —\ *current* | **0.10.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| beartype.typing | *all* | **0.10.0**\ —\ *current* | **0.10.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| beartype.vale_ | Is_ | **0.7.0**\ —\ *current* | **0.7.0**\ —\ *current* |
Expand Down Expand Up @@ -2776,7 +2780,9 @@ Let's chart current and future compliance with Python's `typing`_ landscape:
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| typing_extensions_ | *all attributes* | **0.8.0**\ —\ *current* | **0.8.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| PEP | `484 <PEP 484_>`__ | **0.2.0**\ —\ *current* | *none* |
| PEP | `362 <PEP 362_>`__ | *none* | *none* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| | `484 <PEP 484_>`__ | **0.2.0**\ —\ *current* | *none* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
| | `544 <PEP 544_>`__ | **0.4.0**\ —\ *current* | **0.4.0**\ —\ *current* |
+--------------------+-----------------------------------------+-------------------------------+---------------------------+
Expand Down Expand Up @@ -5026,6 +5032,8 @@ rather than Python runtime) include:
https://www.python.org/dev/peps
.. _PEP 20:
https://www.python.org/dev/peps/pep-0020
.. _PEP 362:
https://www.python.org/dev/peps/pep-0362
.. _PEP 483:
https://www.python.org/dev/peps/pep-0483
.. _PEP 526:
Expand Down
1 change: 0 additions & 1 deletion beartype/abby/__init__.py
Expand Up @@ -25,7 +25,6 @@
# names (e.g., "from argparse import ArgumentParser as _ArgumentParser" rather
# than merely "from argparse import ArgumentParser").
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ....................{ IMPORTS }....................
from beartype.abby._abbytest import (
die_if_unbearable as die_if_unbearable,
is_bearable as is_bearable,
Expand Down
27 changes: 27 additions & 0 deletions beartype/door/__init__.py
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2022 Beartype authors.
# See "LICENSE" for further details.

'''
**Beartype Decidedly Object-Orientedly Recursive (DOOR) API.**
This subpackage provides an object-oriented type hint class hierarchy,
encapsulating the crude non-object-oriented type hint declarative API
standardized by the :mod:`typing` module.
'''

# ....................{ TODO }....................
#FIXME: Publicly document everything in "README.rst", please. *sigh*

# ....................{ IMPORTS }....................
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# WARNING: To avoid polluting the public module namespace, external attributes
# should be locally imported at module scope *ONLY* under alternate private
# names (e.g., "from argparse import ArgumentParser as _ArgumentParser" rather
# than merely "from argparse import ArgumentParser").
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
from beartype.door._doorcls import (
TypeHint as TypeHint,
is_subhint as is_subhint,
)

0 comments on commit d74a4f0

Please sign in to comment.