Coverage for tests/import_test/two/three/success.py: 100%
15 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-08 09:53 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-08 09:53 +0000
1# A module that always works
4def okay() -> bool:
5 """Return `True`."""
6 return True
9class Container:
10 """Class for testing stacklevel."""
12 def inside() -> str:
13 """Return 1."""
14 return "1"
16 @classmethod
17 def level(cls) -> int:
18 """Return the stacklevel of the caller relative to this method."""
19 import warnings
21 from lsst.utils.introspection import find_outside_stacklevel
23 stacklevel = find_outside_stacklevel("import_test")
24 warnings.warn(f"Using stacklevel={stacklevel} in Container class", stacklevel=stacklevel)
25 return stacklevel
27 @classmethod
28 def indirect_level(cls):
29 """Return the stacklevel of the caller relative to this method.
31 Deliberately includes an additional level.
32 """
33 return cls.level()