mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
unittest.mock.PropertyMock return value and attributes are now standard MagicMocks
This commit is contained in:
parent
633b32a7fa
commit
c287062fcf
3 changed files with 25 additions and 0 deletions
|
|
@ -831,5 +831,16 @@ class TestCallList(unittest.TestCase):
|
|||
p.stop()
|
||||
|
||||
|
||||
def test_propertymock_returnvalue(self):
|
||||
m = MagicMock()
|
||||
p = PropertyMock()
|
||||
type(m).foo = p
|
||||
|
||||
returned = m.foo
|
||||
p.assert_called_once_with()
|
||||
self.assertIsInstance(returned, MagicMock)
|
||||
self.assertNotIsInstance(returned, PropertyMock)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue