diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | pyparsing.py | 6 | ||||
-rw-r--r-- | unitTests.py | 17 |
3 files changed, 26 insertions, 3 deletions
@@ -2,6 +2,12 @@ Change Log ========== +Version 2.4.4 - November, 2019 +-------------------------------- +- Unresolved symbol reference in 2.4.3 release was masked by stdout + buffering in unit tests, thanks for the prompt heads-up, Ned Batchelder! + + Version 2.4.3 - November, 2019 ------------------------------ - Fixed a bug in ParserElement.__eq__ that would for some parsers diff --git a/pyparsing.py b/pyparsing.py index 7e35ed2..a0a1147 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -95,8 +95,8 @@ classes inherit from. Use the docstrings for examples of how to: namespace class """ -__version__ = "2.4.3" -__versionTime__ = "21 Oct 2019 23:43 UTC" +__version__ = "2.4.4" +__versionTime__ = "05 Nov 2019 14:15 UTC" __author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" import string @@ -5517,7 +5517,7 @@ def oneOf(strs, caseless=False, useRegex=True, asKeyword=False): # ~ print (strs, "->", "|".join([_escapeRegexChars(sym) for sym in symbols])) try: if len(symbols) == len("".join(symbols)): - return Regex("[%s]" % "".join(_collapseAndEscapeRegexRangeChars(sym) for sym in symbols)).setName(' | '.join(symbols)) + return Regex("[%s]" % "".join(_escapeRegexRangeChars(sym) for sym in symbols)).setName(' | '.join(symbols)) else: return Regex("|".join(re.escape(sym) for sym in symbols)).setName(' | '.join(symbols)) except Exception: diff --git a/unitTests.py b/unitTests.py index cfc4e90..da15ae3 100644 --- a/unitTests.py +++ b/unitTests.py @@ -85,6 +85,8 @@ BUFFER_OUTPUT = True class ParseTestCase(TestCase): def __init__(self): super(ParseTestCase, self).__init__(methodName='_runTest') + self.expect_traceback = False + self.expect_warning = False def _runTest(self): @@ -103,6 +105,12 @@ class ParseTestCase(TestCase): print_("<<<< End of test",str(self)) print_() + output = buffered_stdout.getvalue() + if "Traceback" in output and not self.expect_traceback: + raise Exception("traceback in stdout") + if "Warning" in output and not self.expect_warning: + raise Exception("warning in stdout") + except Exception as exc: if BUFFER_OUTPUT: print_() @@ -1247,6 +1255,8 @@ class EllipsisRepetionTest(ParseTestCase): class CustomQuotesTest(ParseTestCase): def runTest(self): + self.expect_warning = True + from pyparsing import QuotedString testString = r""" @@ -1861,6 +1871,7 @@ class UpcaseDowncaseUnicode(ParseTestCase): class ParseUsingRegex(ParseTestCase): def runTest(self): + self.expect_warning = True import re @@ -1963,6 +1974,7 @@ class RegexAsTypeTest(ParseTestCase): class RegexSubTest(ParseTestCase): def runTest(self): + self.expect_warning = True import pyparsing as pp print_("test sub with string") @@ -3963,6 +3975,8 @@ class LiteralExceptionTest(ParseTestCase): class ParseActionExceptionTest(ParseTestCase): def runTest(self): + self.expect_traceback = True + import pyparsing as pp import traceback @@ -4614,6 +4628,8 @@ class WarnUngroupedNamedTokensTest(ParseTestCase): " ungrouped named expressions"): path = coord[...].setResultsName('path') + pp.__diag__.warn_ungrouped_named_tokens_in_collection = False + class WarnNameSetOnEmptyForwardTest(ParseTestCase): """ @@ -4715,6 +4731,7 @@ class UndesirableButCommonPracticesTest(ParseTestCase): class MiscellaneousParserTests(ParseTestCase): def runTest(self): + self.expect_warning = True runtests = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" if IRON_PYTHON_ENV: |