in testslide/__init__.py [0:0]
def __getattr__(self, name: str) -> Any:
if name in self._all_methods.keys():
def static(*args: Any, **kwargs: Any) -> Any:
return self._all_methods[name](self, *args, **kwargs)
self.__dict__[name] = static
if name in self._all_memoizable_attributes.keys():
attribute_code = self._all_memoizable_attributes[name]
if self._example.is_async and inspect.iscoroutinefunction(attribute_code):
raise ValueError(
f"Function can not be a coroutine function: {repr(attribute_code)}"
)
self._formatter.dsl_memoize(self._example, attribute_code)
self.__dict__[name] = attribute_code(self)
try:
return self.__dict__[name]
except KeyError:
# Forward assert* methods to unittest.TestCase
if re.match("^assert", name) and hasattr(self._test_case, name):
return getattr(self._test_case, name)
raise AttributeError(
"Context '{}' has no attribute '{}'".format(self._context, name)
)