mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #19594: Use specific asserts in unittest tests.
This commit is contained in:
parent
7c5e24f948
commit
5665bc5980
7 changed files with 28 additions and 28 deletions
|
|
@ -52,7 +52,7 @@ class MockTest(unittest.TestCase):
|
|||
"method_calls not initialised correctly")
|
||||
|
||||
# Can't use hasattr for this test as it always returns True on a mock
|
||||
self.assertFalse('_items' in mock.__dict__,
|
||||
self.assertNotIn('_items', mock.__dict__,
|
||||
"default mock should not have '_items' attribute")
|
||||
|
||||
self.assertIsNone(mock._mock_parent,
|
||||
|
|
@ -493,19 +493,19 @@ class MockTest(unittest.TestCase):
|
|||
pass
|
||||
|
||||
mock = Mock(spec=X)
|
||||
self.assertTrue(isinstance(mock, X))
|
||||
self.assertIsInstance(mock, X)
|
||||
|
||||
mock = Mock(spec=X())
|
||||
self.assertTrue(isinstance(mock, X))
|
||||
self.assertIsInstance(mock, X)
|
||||
|
||||
self.assertIs(mock.__class__, X)
|
||||
self.assertEqual(Mock().__class__.__name__, 'Mock')
|
||||
|
||||
mock = Mock(spec_set=X)
|
||||
self.assertTrue(isinstance(mock, X))
|
||||
self.assertIsInstance(mock, X)
|
||||
|
||||
mock = Mock(spec_set=X())
|
||||
self.assertTrue(isinstance(mock, X))
|
||||
self.assertIsInstance(mock, X)
|
||||
|
||||
|
||||
def test_setting_attribute_with_spec_set(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue