Skip to content

Commit 1a39f11

Browse files
committed
Update CHANGES and timestamp from #362; fix related unit test and ValueError message
1 parent 5a411e3 commit 1a39f11

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

pyparsing/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def __repr__(self):
126126

127127

128128
__version_info__ = version_info(3, 0, 7, "final", 0)
129-
__version_time__ = "06 Feb 2022 01:42 UTC"
129+
__version_time__ = "06 Feb 2022 02:15 UTC"
130130
__version__ = __version_info__.__version__
131131
__versionTime__ = __version_time__
132132
__author__ = "Paul McGuire <[email protected]>"

pyparsing/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
str_type: Tuple[type, ...] = (str, bytes)
5454

5555
#
56-
# Copyright (c) 2003-2021 Paul T. McGuire
56+
# Copyright (c) 2003-2022 Paul T. McGuire
5757
#
5858
# Permission is hereby granted, free of charge, to any person obtaining
5959
# a copy of this software and associated documentation files (the
@@ -2960,7 +2960,6 @@ def __init__(
29602960
if self.asMatch:
29612961
self.parseImpl = self.parseImplAsMatch
29622962

2963-
29642963
@cached_property
29652964
def re(self):
29662965
if self._re:
@@ -2970,7 +2969,7 @@ def re(self):
29702969
return re.compile(self.pattern, self.flags)
29712970
except sre_constants.error:
29722971
raise ValueError(
2973-
"invalid pattern ({!r}) passed to Regex".format(pattern)
2972+
"invalid pattern ({!r}) passed to Regex".format(self.pattern)
29742973
)
29752974

29762975
@cached_property

tests/test_unit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,7 +3487,7 @@ def testMatch(expression, instring, shouldPass, expectedString=None):
34873487
try:
34883488
print("lets try an invalid RE")
34893489
invRe = pp.Regex("(\"[^\"]*\")|('[^']*'").re
3490-
except Exception as e:
3490+
except ValueError as e:
34913491
print("successfully rejected an invalid RE:", end=" ")
34923492
print(e)
34933493
else:
@@ -3496,7 +3496,7 @@ def testMatch(expression, instring, shouldPass, expectedString=None):
34963496
with self.assertRaises(
34973497
ValueError, msg="failed to warn empty string passed to Regex"
34983498
):
3499-
invRe = pp.Regex("")
3499+
pp.Regex("").re
35003500

35013501
def testRegexAsType(self):
35023502

0 commit comments

Comments
 (0)