File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ def order_future_lines(code):
4444 if line .startswith ('from __future__ import ' )]
4545
4646 future_line_numbers = [i for i , line in enumerate (lines )
47- if line .startswith ('from future' )]
47+ if line .startswith ('from future' )
48+ or line .startswith ('from past' )]
4849
4950 builtins_line_numbers = [i for i , line in enumerate (lines )
5051 if line .startswith ('from builtins' )]
@@ -56,7 +57,7 @@ def mymax(numbers):
5657 return max (numbers ) if len (numbers ) > 0 else 0
5758
5859 def mymin (numbers ):
59- return min (numbers ) if len (numbers ) > 0 else 0
60+ return min (numbers ) if len (numbers ) > 0 else float ( 'inf' )
6061
6162 assert mymax (uufuture_line_numbers ) <= mymin (future_line_numbers ), \
6263 'the __future__ and future imports are out of order'
Original file line number Diff line number Diff line change @@ -104,7 +104,22 @@ def test_encoding_comments_kept_at_top(self):
104104 from __future__ import print_function
105105 print('Hello')
106106 """
107- self .convert_check (before , after )
107+ self .convert_check (before , after , ignore_imports = False )
108+
109+ # Issue #121. This fails as of v0.14.1:
110+ before = u"""
111+ # -*- coding: utf-8 -*-
112+ # Author: etc. with some unicode ¿.
113+ 1 / 2
114+ """
115+ after = u"""
116+ # -*- coding: utf-8 -*-
117+ # Author: etc. with some unicode ¿.
118+ from __future__ import division
119+ from past.utils import old_div
120+ old_div(1, 2)
121+ """
122+ self .convert_check (before , after , ignore_imports = False )
108123
109124 def test_shebang_blank_with_future_division_import (self ):
110125 """
@@ -435,7 +450,7 @@ def test_source_coding_utf8(self):
435450 """
436451 code = """
437452 # -*- coding: utf-8 -*-
438- icons = [u"◐ ", u"◓ ", u"◑ ", u"◒ "]
453+ icons = [u"â ", u"â ", u"â ", u"â "]
439454 """
440455 self .unchanged (code )
441456
You can’t perform that action at this time.
0 commit comments