In the Python module typing, they have a really useful constant, which is Truetype checking, but Falseotherwise. This means, for example, that you can dynamically import classes if TYPE_CHECKINGevaluated as True.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from module import Class
It would be very helpful if there unittestwas something like that. I can see in the file __init__.py, there is a variable defined as __unittest = True:
__all__ = ['TestResult', 'TestCase', 'TestSuite',
'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main',
'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless',
'expectedFailure', 'TextTestResult', 'installHandler',
__unittest = True
Can I use the __unittestsame as TYPE_CHECKINGfrom typing?
: , . , , . , .
!