def __validate_attribute_type()

in testslide/strict_mock.py [0:0]


    def __validate_attribute_type(self, name: str, value: Any) -> None:
        if (
            not self.__dict__["_type_validation"]
            or name in self.__dict__["_attributes_to_skip_type_validation"]
        ):
            return

        if self._template is not None:
            try:
                annotations = get_type_hints(self._template)
            except Exception:
                # Some modules can throw KeyError : https://bugs.python.org/issue41515
                annotations = {}
            if name in annotations:
                testslide.lib._validate_argument_type(annotations[name], name, value)