Skip to content

Commit

Permalink
Use super for output checker inheritance
Browse files Browse the repository at this point in the history
Remove previous workarounds for Python 2 old-style classes.
  • Loading branch information
matthew-brett committed Sep 25, 2023
1 parent c93a231 commit 1359b82
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pytest_doctestplus/output_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class OutputChecker(doctest.OutputChecker):
rtol = 1e-05
atol = 1e-08

_original_output_checker = doctest.OutputChecker

_str_literal_re = re.compile(
r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE)
_byteorder_re = re.compile(
Expand Down Expand Up @@ -281,18 +279,13 @@ def check_output(self, want, got, flags):
if flags & FLOAT_CMP:
return self.normalize_floats(want, got, flags)

# Can't use super here because doctest.OutputChecker is not a
# new-style class.
return self._original_output_checker.check_output(
self, want, got, flags)
return self(super).check_output(want, got, flags)

def output_difference(self, want, got, flags):
if flags & FIX:
want, got = self.do_fixes(want, got)

# Can't use super here because doctest.OutputChecker is not a
# new-style class.
return self._original_output_checker.output_difference(
return self(super).output_difference(
self, want, got, flags)


Expand Down

0 comments on commit 1359b82

Please sign in to comment.