Skip to content

Commit b3beb0d

Browse files
committed
Add a failing test: whether futurize invokes old_div() when __future__.division is already imported.
It shouldn't be ;)
1 parent f4ed99c commit b3beb0d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

future/tests/test_futurize.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,6 @@ def test_literal_prefixes_are_not_stripped(self):
517517
self.unchanged(code)
518518

519519
def test_division(self):
520-
"""
521-
TODO: implement this!
522-
"""
523520
before = """
524521
x = 1 / 2
525522
"""
@@ -529,6 +526,16 @@ def test_division(self):
529526
"""
530527
self.convert_check(before, after, stages=[1, 2])
531528

529+
def test_already_future_division(self):
530+
code = """
531+
from __future__ import division
532+
x = 1 / 2
533+
assert x == 0.5
534+
y = 3. / 2.
535+
assert y == 1.5
536+
"""
537+
self.unchanged(code)
538+
532539

533540
class TestFuturizeRenamedStdlib(CodeHandler):
534541
@unittest.skip('Infinite loop?')

0 commit comments

Comments
 (0)