Skip to content

Commit

Permalink
use assertRaises instead of try/except for expected KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
wohnlice committed May 8, 2020
1 parent 341d69c commit 419d3be
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Products/PluginIndexes/FieldIndex/tests.py
Expand Up @@ -224,13 +224,8 @@ def testReindexNone(self):
d._foo = None
self._index.index_object(2, d)
self._checkApply({'foo': 'abc'}, [])
try:
should_not_be = self._index.keyForDocument(2)
except KeyError:
# As expected, that attribute is None
pass
else:
raise ValueError(repr(should_not_be))
with self.assertRaises(KeyError):
self._index.keyForDocument(2)

def testReindex(self):
self._populateIndex()
Expand Down

0 comments on commit 419d3be

Please sign in to comment.