Skip to content

Commit

Permalink
Use isinstance and issubclass in partial ordering tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Jan 20, 2024
1 parent fb173ad commit bc6bdaf
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/plone/folder/tests/test_partialordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ def runTableTests(self, action, tests):
container, ordering = self.create()
ids = set(container.objectIds())
method = getattr(ordering, action)
if isinstance(rval, type):
# This means the return value is an Exception class.
# It is NOT an *instance* of an Exception class,
# so the following would not work:
# isinstance(rval, Exception)
if isinstance(rval, type) and issubclass(rval, Exception):
self.assertRaises(rval, method, *args)
else:
self.assertEqual(method(*args), rval)
Expand Down

0 comments on commit bc6bdaf

Please sign in to comment.