Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up whitespace damage and adjust assert
Fix accidental whitespace damage introduced from the web UI.

Slight change from the originally suggested assert as mocks do not
provide the implementation of the class, only the interface of it.

Instead, we can assert the return value from the actual object after
accessing the property.
  • Loading branch information
melwitt committed Aug 19, 2021
commit a916d4b1743d8287f37518b602705a96e1fc99af
4 changes: 2 additions & 2 deletions Lib/unittest/test/testmock/testmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def instance(self):
if not self._instance:
self._instance = 'object'
return self._instance

Comment thread
melwitt marked this conversation as resolved.
Outdated

class Typos():
autospect = None
Expand Down Expand Up @@ -2265,7 +2265,7 @@ def test_property_not_called_with_spec_mock(self):
self.assertIsNone(obj._instance, msg='before mock')
mock = Mock(spec=obj)
self.assertIsNone(obj._instance, msg='after mock')
self.assertEqual(mock.instance, 'instance')
self.assertEqual('object', obj.instance)

if __name__ == '__main__':
unittest.main()