Skip to content

Commit

Permalink
Cleaned up Py23DocChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Feb 8, 2019
1 parent 86a55ec commit 3ef3106
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ History
- replaced print statement
- mangled doctests, added Py23DocChecker
- fixed boolean value of AccountExpired
[reinhardt]


1.0b8 (2018-10-22)
Expand Down
9 changes: 2 additions & 7 deletions src/node/ext/ldap/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@


class Py23DocChecker(doctest.OutputChecker):
exclude = [
#"<.*>$", # object repr
#"^\S*Error: ", # raised error
]

def check_output(self, want, got, optionflags):
if want != got and six.PY2:
# if running on py2, ignore any "u" prefixes in the output
if not any(re.match(pattern, want) for pattern in self.exclude):
got = re.sub("(\\W|^)u'(.*?)'", "\\1'\\2'", got)
got = re.sub("(\\W|^)u\"(.*?)\"", "\\1\"\\2\"", got)
got = re.sub("(\\W|^)u'(.*?)'", "\\1'\\2'", got)
got = re.sub("(\\W|^)u\"(.*?)\"", "\\1\"\\2\"", got)
# also ignore "b" prefixes in the expected output
want = re.sub("b'(.*?)'", "'\\1'", want)
# we get 'ldap.' prefixes on python 3, e.g.
Expand Down

0 comments on commit 3ef3106

Please sign in to comment.