Skip to content

Commit

Permalink
remove flake8 exclude for W601 and fix that
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Oct 3, 2018
1 parent df905a6 commit 78ab8f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ ignore =
E721
F841
E722
W601
F401


Expand Down
7 changes: 5 additions & 2 deletions src/Products/Sessions/tests/testSessionDataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ def testInvalidateSessionDataObject(self):
sd = sdm.getSessionData()
sd['test'] = 'Its alive! Alive!'
sd.invalidate()
self.assertTrue(not sdm.getSessionData().has_key('test'))
# getSessionData() object did not implement a ``__contains__`` method
# so a new style ```'test' not in sdm.getSessionData() did not work.```
self.assertTrue(not sdm.getSessionData().has_key('test')) # NOQA: W601
# self.assertTrue('test' not in sdm.getSessionData())

def testGhostUnghostSessionManager(self):
import transaction
Expand Down Expand Up @@ -250,7 +253,7 @@ def testAutoReqPopulate(self):
self.app.REQUEST['PARENTS'] = [self.app]
self.app.REQUEST['URL'] = 'a'
self.app.REQUEST.traverse('/')
self.assertTrue(self.app.REQUEST.has_key('TESTOFSESSION'))
self.assertTrue('TESTOFSESSION' in self.app.REQUEST)

def testUnlazifyAutoPopulated(self):
from Acquisition import aq_base
Expand Down
9 changes: 7 additions & 2 deletions src/Products/Transience/tests/testTransientObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ def test_dictionaryLike(self):
with self.assertRaises(AttributeError):
self._genLenError(t)
self.assertIsNone(t.get('foobie', None))
self.assertTrue(t.has_key('a'))
self.assertFalse(t.has_key('foobie'))
# Test with .has_key() are necessary:
# as t did not have a __contains__ method
# normally you would test like that:
# >>> self.assertTrue('a' in t)
# >>> self.assertFalse('foobie' in t)
self.assertTrue(t.has_key('a')) # NOQA: W601
self.assertFalse(t.has_key('foobie')) # NOQA: W601
t.clear()
self.assertEqual(len(t.keys()), 0)

Expand Down

0 comments on commit 78ab8f0

Please sign in to comment.