Skip to content

Commit

Permalink
Merge pull request #225 from matthew-brett/precautionary-init
Browse files Browse the repository at this point in the history
Precautionary init for OutputChecker
  • Loading branch information
pllim authored Sep 26, 2023
2 parents 21d12f3 + c3782fd commit ed9ce83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pytest_doctestplus/output_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class OutputChecker(doctest.OutputChecker):
r"([0-9]+)L", re.UNICODE)

def __init__(self):
# NOTE OutputChecker is an old-style class with no __init__ method,
# so we can't call the base class version of __init__ here

exp = r'(?:e[+-]?\d+)'

got_floats = (r'\s*([+-]?\d+\.\d*{0}?|'
Expand All @@ -78,6 +75,10 @@ def __init__(self):
fmidend = r'(?<={}){}(?={}|$)'.format(front_sep, want_floats, back_sep)
self.num_want_rgx = re.compile(r'({}|{})'.format(fbeg, fmidend))

# As of 2023-09-26, Python base class has no init, but just in case
# it acquires one.
super().__init__()

def do_fixes(self, want, got):
want = re.sub(self._str_literal_re, r'\1\2', want)
want = re.sub(self._byteorder_re, r'\1\2\3', want)
Expand Down

0 comments on commit ed9ce83

Please sign in to comment.