File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,39 @@ def setUp(self):
3636 self .tempdir = tempfile .mkdtemp () + os .path .sep
3737 super (TestFuturizeSimple , self ).setUp ()
3838
39+ def test_encoding_comments_kept_at_top (self ):
40+ """
41+ Issues #10 and #97: If there is a source encoding comment line
42+ (PEP 263), is it kept at the top of a module by ``futurize``?
43+ """
44+ before = """
45+ # coding=utf-8
46+
47+ print 'Hello'
48+ """
49+ after = """
50+ # coding=utf-8
51+
52+ from __future__ import print_function
53+ print('Hello')
54+ """
55+ self .convert_check (before , after )
56+
57+ before = """
58+ #!/usr/bin/env python
59+ # -*- coding: latin-1 -*-"
60+
61+ print 'Hello'
62+ """
63+ after = """
64+ #!/usr/bin/env python
65+ # -*- coding: latin-1 -*-"
66+
67+ from __future__ import print_function
68+ print('Hello')
69+ """
70+ self .convert_check (before , after )
71+
3972 def test_shebang_blank_with_future_division_import (self ):
4073 """
4174 Issue #43: Is shebang line preserved as the first
You can’t perform that action at this time.
0 commit comments