summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest
diff options
context:
space:
mode:
authorandrei kulakov <andrei.avk@gmail.com>2022-11-07 07:24:46 (GMT)
committerGitHub <noreply@github.com>2022-11-07 07:24:46 (GMT)
commitc6325b1c9fe60f72bb3fa4b8570a699e9e97af53 (patch)
tree05a9eefebd36ee790af947636a63aede36b32908 /Lib/test/test_unittest
parent728e42fcf51cbb2108caf1382df224c13b53d024 (diff)
downloadcpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.zip
cpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.tar.gz
cpython-c6325b1c9fe60f72bb3fa4b8570a699e9e97af53.tar.bz2
gh-91803: Mock - fix error when using autospec methods with seal (#92213)
Fixes https://github.com/python/cpython/issues/91803. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_unittest')
-rw-r--r--Lib/test/test_unittest/testmock/testsealable.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_unittest/testmock/testsealable.py b/Lib/test/test_unittest/testmock/testsealable.py
index daba2b4..e0c3829 100644
--- a/Lib/test/test_unittest/testmock/testsealable.py
+++ b/Lib/test/test_unittest/testmock/testsealable.py
@@ -200,6 +200,9 @@ class TestSealable(unittest.TestCase):
self.assertIsInstance(foo.Baz.baz, mock.NonCallableMagicMock)
self.assertIsInstance(foo.Baz.ban, mock.MagicMock)
+ # see gh-91803
+ self.assertIsInstance(foo.bar2(), mock.MagicMock)
+
self.assertEqual(foo.bar1(), 'a')
foo.bar1.return_value = 'new_a'
self.assertEqual(foo.bar1(), 'new_a')
@@ -212,7 +215,7 @@ class TestSealable(unittest.TestCase):
with self.assertRaises(AttributeError):
foo.bar = 1
with self.assertRaises(AttributeError):
- foo.bar2()
+ foo.bar2().x
foo.bar2.return_value = 'bar2'
self.assertEqual(foo.bar2(), 'bar2')