Skip to content

Commit e05053a

Browse files
committed
gh-153581: Adds assertions to the added test
1 parent 87bc38e commit e05053a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎Lib/test/test_unittest/testmock/testpatch.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,13 +1089,20 @@ def method(self, a, b, c=3):
10891089
return a, b, c
10901090
partial_method = functools.partialmethod(method, 1)
10911091

1092-
Foo().partial_method(2)
1092+
results = Foo().partial_method(2)
1093+
self.assertEqual(results, (1, 2, 3))
10931094

10941095
with patch.object(Foo, 'partial_method', autospec=True) as method:
10951096
self.assertNotIsInstance(method, NonCallableMagicMock)
10961097
foo = Foo()
1097-
foo.partial_method(2)
1098+
1099+
result = foo.partial_method(2)
1100+
self.assertEqual(result, method.return_value)
1101+
method.assert_called_once_with(2)
1102+
10981103
foo.partial_method(2, c=4)
1104+
method.assert_called_with(2, c=4)
1105+
10991106
self.assertRaises(TypeError, foo.partial_method)
11001107
self.assertRaises(TypeError, foo.partial_method, 2, 3, 4)
11011108
self.assertRaises(TypeError, foo.partial_method, 2, foo="lish")

0 commit comments

Comments
 (0)