Example #1
0
    def test_order_future_lines(self):
        """
        Tests the internal order_future_lines() method.
        """
        before = '''
               # comment here
               from __future__ import print_function
               from __future__ import absolute_import
                                 # blank line or comment here
               from future.builtins import zzz
               from future.builtins import aaa
               from future.builtins import blah
               # another comment

               code_here
               more_code_here
               '''
        after = '''
               # comment here
               from __future__ import absolute_import
               from __future__ import print_function
                                 # blank line or comment here
               from future.builtins import aaa
               from future.builtins import blah
               from future.builtins import zzz
               # another comment

               code_here
               more_code_here
               '''
        self.assertEqual(order_future_lines(reformat_code(before)),
                         reformat_code(after))
Example #2
0
    def test_order_future_lines(self):
        """
        Tests the internal order_future_lines() function.
        """
        before = """
               # comment here
               from __future__ import print_function
               from __future__ import absolute_import
                                 # blank line or comment here
               from future.utils import with_metaclass
               from builtins import zzz
               from builtins import aaa
               from builtins import blah
               # another comment

               import something_else
               code_here
               more_code_here
               """
        after = """
               # comment here
               from __future__ import absolute_import
               from __future__ import print_function
                                 # blank line or comment here
               from future.utils import with_metaclass
               from builtins import aaa
               from builtins import blah
               from builtins import zzz
               # another comment

               import something_else
               code_here
               more_code_here
               """
        self.assertEqual(order_future_lines(reformat_code(before)), reformat_code(after))
Example #3
0
    def test_order_future_lines(self):
        """
        Tests the internal order_future_lines() method.
        """
        before = '''
               # comment here
               from __future__ import print_function
               from __future__ import absolute_import
                                 # blank line or comment here
               from future.builtins import zzz
               from future.builtins import aaa
               from future.builtins import blah
               # another comment

               code_here
               more_code_here
               '''
        after = '''
               # comment here
               from __future__ import absolute_import
               from __future__ import print_function
                                 # blank line or comment here
               from future.builtins import aaa
               from future.builtins import blah
               from future.builtins import zzz
               # another comment

               code_here
               more_code_here
               '''
        self.assertEqual(order_future_lines(reformat_code(before)),
                         reformat_code(after))