mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-41403: Improve error message for invalid mock target (GH-30833)
This commit is contained in:
parent
ca78130d7e
commit
f7955a82e3
3 changed files with 13 additions and 5 deletions
|
@ -1933,8 +1933,13 @@ class PatchTest(unittest.TestCase):
|
|||
|
||||
|
||||
def test_invalid_target(self):
|
||||
with self.assertRaises(TypeError):
|
||||
patch('')
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
for target in ['', 12, Foo()]:
|
||||
with self.subTest(target=target):
|
||||
with self.assertRaises(TypeError):
|
||||
patch(target)
|
||||
|
||||
|
||||
def test_cant_set_kwargs_when_passing_a_mock(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue