Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support subclassing StrictMock #90

Closed
fornellas opened this issue Nov 15, 2019 · 0 comments · Fixed by #93
Closed

Support subclassing StrictMock #90

fornellas opened this issue Nov 15, 2019 · 0 comments · Fixed by #93
Assignees
Labels
bug Something isn't working

Comments

@fornellas
Copy link
Contributor

This should work:

from testslide import StrictMock

class Template:
  def __eq__(self, other):
    return False

class TemplateStrictMock(StrictMock):
  def __init__(self):
    super().__init__(template=Template)

  def __eq__(self, other):
    return False

mock = TemplateStrictMock()
assert (mock == mock) is False

But is currently failing with:

testslide.strict_mock.UndefinedAttribute: '__eq__' is not set.
<StrictMock 0x7F6A9E5F4D90 template=__main__.Template test.py:9> must have a value set for this attribute if it is going to be accessed.
@fornellas fornellas self-assigned this Nov 15, 2019
@fornellas fornellas added the bug Something isn't working label Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant