Description
My reproduction (python 2)
import mock
from typing import Generic, TypeVar
T = TypeVar('T')
class Bar(Generic[T]):
def __init__(self):
pass
def do_bar(self):
print("bar")
class Foo(Bar[int]):
def do_foo(self):
self.do_bar()
@mock.patch.object(Bar, 'do_bar')
def mocked(mock_do_bar):
mock_do_bar.return_value = None
foo = Foo()
foo.do_foo()
mocked()
will unexpectedly print bar
.
The inheritance here is crucial.
Metadata
Metadata
Assignees
Labels
No labels