Skip to content

Commit

Permalink
Merge 6aaa8bc into c2ea8df
Browse files Browse the repository at this point in the history
  • Loading branch information
fornellas committed Feb 24, 2021
2 parents c2ea8df + 6aaa8bc commit fdcb13c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/strict_mock_testslide.py
Expand Up @@ -118,7 +118,6 @@ def __hash__(self):
class TemplateBaseStrictMock(StrictMock):
def __init__(self):
super().__init__(template=Template)
self.__instance_method_return = "mock"

@staticmethod
def static_method(message):
Expand All @@ -130,6 +129,7 @@ def __len__(self):

class TemplateStrictMock(TemplateBaseStrictMock):
def instance_method(self, message):
self.__instance_method_return = "mock"
return self.__instance_method_return


Expand Down
7 changes: 4 additions & 3 deletions testslide/strict_mock.py
Expand Up @@ -626,9 +626,10 @@ def __validate_attribute_type(self, name: str, value: Any) -> None:
def __validate_and_wrap_mock_value(self, name: str, value: Any) -> Any:
if self._template:
if not self.__template_has_attr(name):
if not (name.startswith(f"_{type(self).__name__}__") and not name.endswith(
"__"
)):
if not (
name.startswith(f"_{type(self).__name__}__")
and not name.endswith("__")
):
raise NonExistentAttribute(self, name)

self.__validate_attribute_type(name, value)
Expand Down

0 comments on commit fdcb13c

Please sign in to comment.