summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul McGuire <paulmcg@infinite.io>2019-11-05 08:50:43 -0600
committerPaul McGuire <paulmcg@infinite.io>2019-11-05 08:50:43 -0600
commitd78e9319916c9bc7853e4e16a96c8bae56272b45 (patch)
tree1bb2e78afff309ae87902689cfbe58965e2a2ede
parent89be5c81b106f4fed9a7b815841bdcf85f870297 (diff)
downloadpyparsing-git-d78e9319916c9bc7853e4e16a96c8bae56272b45.tar.gz
Unresolved symbol reference in 2.4.3 release was masked by stdout buffering in unit tests
-rw-r--r--CHANGES6
-rw-r--r--pyparsing.py6
-rw-r--r--unitTests.py17
3 files changed, 26 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index fc9ff71..22c77ac 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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: