Issue #19594: Use specific asserts in unittest tests.

This commit is contained in:
Serhiy Storchaka 2013-11-17 00:12:21 +02:00
parent 7c5e24f948
commit 5665bc5980
7 changed files with 28 additions and 28 deletions

View file

@ -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):