Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Lib/unittest/test/testmock/testhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)

from datetime import datetime
from functools import partial

class SomeClass(object):
def one(self, a, b):
Expand Down Expand Up @@ -871,6 +872,19 @@ def test_autospec_on_bound_builtin_function(self):
mocked.assert_called_once_with(4, 5, 6)


def test_autospec_getattr_partial_function(self):
# bpo-32153 : getattr returning partial functions without
# __name__ should not create AttributeError in create_autospec
class Foo:

def __getattr__(self, attribute):
return partial(lambda name: name, attribute)

proxy = Foo()
autospec = create_autospec(proxy)
self.assertFalse(hasattr(autospec, '__name__'))


class TestCallList(unittest.TestCase):

def test_args_list_contains_call_list(self):
Expand Down