Skip to content

Commit 03770db

Browse files
author
Jordan Adler
committed
bugfix
1 parent 8209539 commit 03770db

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libfuturize/fixes/fix_division_safe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def match_division(node):
3131
return node.type == slash and not node.next_sibling.type == slash and \
3232
not node.prev_sibling.type == slash
3333

34-
const_re = re.compile('^[0-9.]+$')
34+
const_re = re.compile('^[0-9]*[.][0-9]*$')
3535

3636

3737
def _is_floaty(expr):

tests/test_future/test_futurize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ def test_safe_division(self):
11791179
from __future__ import division
11801180
from past.utils import old_div
11811181
x = old_div(3, 2)
1182-
y = old_div(3., 2)
1182+
y = 3. / 2
11831183
assert x == 1 and isinstance(x, int)
11841184
assert y == 1.5 and isinstance(y, float)
11851185
"""

0 commit comments

Comments
 (0)