Skip to content

Commit e7d271b

Browse files
committed
Fix FLOAT_CMP to include the sign of the number looked at.
1 parent f18f256 commit e7d271b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎astropy/tests/output_checker.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ def __init__(self):
5454

5555
exp = r'(?:e[+-]?\d+)'
5656

57-
got_floats = r'(\d+\.\d*%s?|\.\d+%s?|\d+%s)' % (exp, exp, exp)
57+
got_floats = r'([+-]?\d+\.\d*%s?|[+-]?\.\d+%s?|[+-]?\d+%s)' % (exp, exp, exp)
5858

5959
# floats in the 'want' string may contain ellipses
6060
want_floats = got_floats + r'(\.{3})?'
6161

62-
front_sep = r'\s|[+*,(<=-]'
63-
back_sep = front_sep + r'|[)>j]'
62+
front_sep = r'\s|[*+-,<=(\[]'
63+
back_sep = front_sep + r'|[>j)\]]'
6464

6565
fbeg = r'^%s(?=%s|$)' % (got_floats, back_sep)
6666
fmidend = r'(?<=%s)%s(?=%s|$)' % (front_sep, got_floats, back_sep)
@@ -107,7 +107,6 @@ def normalize_floats(self, want, got, flags):
107107
numbers_want = [match.group(1) for match in matches] # list of strs
108108
if len(numbers_got) != len(numbers_want):
109109
return False
110-
111110
if len(numbers_got) > 0:
112111
nw_ = []
113112
for ng, nw in zip(numbers_got, numbers_want):

0 commit comments

Comments
 (0)