Skip to content

Commit 4086858

Browse files
committed
Handle new math domain error msg
1 parent e4762b8 commit 4086858

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/my_github_action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ jobs:
145145
- '3.13.1'
146146
- '3.13.2'
147147
- '3.14.0-alpha.0'
148-
- '3.14.0-alpha.6'
149-
# Disabled because of issue #67 - '3.14.0-alpha.1', ..., '3.14.0-alpha.4'
148+
# Disabled because of issue #67 - '3.14.0-alpha.1', ..., '3.14.0-alpha.6'
150149
- 'pypy-2.7'
151150
- 'pypy-2.7-nightly'
152151
- 'pypy-3.6' # the latest available version of PyPy that supports Python 3.6

didyoumean/didyoumean_re.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
r"(?: from '{1}' \(.*\))?$".format(IDENTIFIER, MODULE_NAME)
5757
INDEXOUTOFRANGE_RE = r"^list index out of range$"
5858
ZERO_LEN_FIELD_RE = r"^zero length field name in format$"
59-
MATH_DOMAIN_ERROR_RE = r"^math domain error$"
59+
MATH_DOMAIN_ERROR_RE = r"^math domain error|" \
60+
r"expected a positive input, got -\d+$"
6061
TOO_MANY_VALUES_UNPACK_RE = r"^too many values " \
6162
r"to unpack(?: \(expected.*\))?$"
6263
OUTSIDE_FUNCTION_RE = r"^'?(\w+)'? outside function$"

didyoumean/didyoumean_re_tests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,12 @@ def test_zero_length_field(self):
371371
def test_math_domain_error(self):
372372
"""Test MATH_DOMAIN_ERROR_RE."""
373373
# Python 2.6/2.7/3.2/3.3/3.4/3.5/PyPy/PyPy3
374-
msg = "math domain error"
375-
self.re_matches(msg, re.MATH_DOMAIN_ERROR_RE, NO_GROUP)
374+
msgs = [
375+
"math domain error",
376+
"expected a positive input, got -1",
377+
]
378+
for msg in msgs:
379+
self.re_matches(msg, re.MATH_DOMAIN_ERROR_RE, NO_GROUP)
376380

377381
def test_too_many_values(self):
378382
"""Test TOO_MANY_VALUES_UNPACK_RE."""

0 commit comments

Comments
 (0)