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 <1378796103.81.0.419617172609.issue18993@psf.upfronthosting.co.za>
In-reply-to
Content
In Lib/unittest/test/testmock/testmock.py, 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 = m.foo
            m.foo = 3
            del m.foo
            self.assertEqual(m.foo, original)

            new = m.foo = Mock()
            del m.foo
            self.assertEqual(m.foo, 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.
History
Date User Action Args
2013-09-10 06:55:03vajraskysetrecipients: + vajrasky
2013-09-10 06:55:03vajraskysetmessageid: <1378796103.81.0.419617172609.issue18993@psf.upfronthosting.co.za>
2013-09-10 06:55:03vajraskylinkissue18993 messages
2013-09-10 06:55:03vajraskycreate