New submission from Vajrasky Kok:

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.

----------
components: Tests
files: remove_wrongly_test_in_testmock.patch
keywords: patch
messages: 197424
nosy: vajrasky
priority: normal
severity: normal
status: open
title: There is an overshadowed and invalid test in testmock.py
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file31708/remove_wrongly_test_in_testmock.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18993>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to