summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-09-16 20:51:56 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-09-16 20:51:56 (GMT)
commitdafea851901fc1de278ad79727d3b44f46ba5a31 (patch)
tree5f8d95de4856502e61c78168e7918776b161e9b4 /Lib/lib2to3/tests
parent975fce37883899a55bbcdaa6300c5c6ffe9d3db2 (diff)
downloadcpython-dafea851901fc1de278ad79727d3b44f46ba5a31.zip
cpython-dafea851901fc1de278ad79727d3b44f46ba5a31.tar.gz
cpython-dafea851901fc1de278ad79727d3b44f46ba5a31.tar.bz2
Issue #18873: The tokenize module, IDLE, 2to3, and the findnocoding.py script
now detect Python source code encoding only in comment lines.
Diffstat (limited to 'Lib/lib2to3/tests')
-rw-r--r--Lib/lib2to3/tests/data/false_encoding.py2
-rw-r--r--Lib/lib2to3/tests/test_refactor.py4
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/lib2to3/tests/data/false_encoding.py b/Lib/lib2to3/tests/data/false_encoding.py
new file mode 100644
index 0000000..f4e59e7
--- /dev/null
+++ b/Lib/lib2to3/tests/data/false_encoding.py
@@ -0,0 +1,2 @@
+#!/usr/bin/env python
+print '#coding=0'
diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py
index 8bdebc1..5ecd9b1 100644
--- a/Lib/lib2to3/tests/test_refactor.py
+++ b/Lib/lib2to3/tests/test_refactor.py
@@ -271,6 +271,10 @@ from __future__ import print_function"""
fn = os.path.join(TEST_DATA_DIR, "different_encoding.py")
self.check_file_refactoring(fn)
+ def test_false_file_encoding(self):
+ fn = os.path.join(TEST_DATA_DIR, "false_encoding.py")
+ data = self.check_file_refactoring(fn)
+
def test_bom(self):
fn = os.path.join(TEST_DATA_DIR, "bom.py")
data = self.check_file_refactoring(fn)