summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testpatch.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/test/testmock/testpatch.py')
-rw-r--r--Lib/unittest/test/testmock/testpatch.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py
index 0632d95..e065a2c 100644
--- a/Lib/unittest/test/testmock/testpatch.py
+++ b/Lib/unittest/test/testmock/testpatch.py
@@ -105,6 +105,10 @@ class PatchTest(unittest.TestCase):
self.assertEqual(Something.attribute, sentinel.Original,
"patch not restored")
+ def test_patchobject_with_string_as_target(self):
+ msg = "'Something' must be the actual object to be patched, not a str"
+ with self.assertRaisesRegex(TypeError, msg):
+ patch.object('Something', 'do_something')
def test_patchobject_with_none(self):
class Something(object):