This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vajrasky
Recipients vajrasky
Date 2013-09-10.06:55:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In Lib/unittest/test/testmock/, there are two test_attribute_deletion. One of them is overshadowed (not executed) by the other.

    def test_attribute_deletion(self):
        # this behaviour isn't *useful*, but at least it's now tested...
        for Klass in Mock, MagicMock, NonCallableMagicMock, NonCallableMock:
            m = Klass()
            original =
   = 3
            self.assertEqual(, original)

            new = = Mock()
            self.assertEqual(, new)

    def test_attribute_deletion(self):
        for mock in Mock(), MagicMock():
            self.assertTrue(hasattr(mock, 'm'))

            del mock.m
            self.assertFalse(hasattr(mock, 'm'))

            del mock.f
            self.assertFalse(hasattr(mock, 'f'))
            self.assertRaises(AttributeError, getattr, mock, 'f')

They are testing the same thing but with different expectations. The first one is invalid and should be removed. The patch altered a bit of the second test to incorporate more mock classes.
Date User Action Args
2013-09-10 06:55:03vajraskysetrecipients: + vajrasky
2013-09-10 06:55:03vajraskysetmessageid: <>
2013-09-10 06:55:03vajraskylinkissue18993 messages
2013-09-10 06:55:03vajraskycreate