Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(28055)

Side by Side Diff: Lib/lib2to3/tests/test_refactor.py

Issue 18873: "Encoding" detected in non-comment lines
Patch Set: Created 6 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 """ 1 """
2 Unit tests for refactor.py. 2 Unit tests for refactor.py.
3 """ 3 """
4 4
5 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import sys 7 import sys
8 import os 8 import os
9 import codecs 9 import codecs
10 import operator 10 import operator
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 "sappy"] 263 "sappy"]
264 expected = ["hi.py"] 264 expected = ["hi.py"]
265 check(tree, expected) 265 check(tree, expected)
266 tree = ["hi.py", 266 tree = ["hi.py",
267 os.path.join("a_dir", "stuff.py")] 267 os.path.join("a_dir", "stuff.py")]
268 check(tree, tree) 268 check(tree, tree)
269 269
270 def test_file_encoding(self): 270 def test_file_encoding(self):
271 fn = os.path.join(TEST_DATA_DIR, "different_encoding.py") 271 fn = os.path.join(TEST_DATA_DIR, "different_encoding.py")
272 self.check_file_refactoring(fn) 272 self.check_file_refactoring(fn)
273
274 def test_false_file_encoding(self):
275 fn = os.path.join(TEST_DATA_DIR, "false_encoding.py")
276 data = self.check_file_refactoring(fn)
273 277
274 def test_bom(self): 278 def test_bom(self):
275 fn = os.path.join(TEST_DATA_DIR, "bom.py") 279 fn = os.path.join(TEST_DATA_DIR, "bom.py")
276 data = self.check_file_refactoring(fn) 280 data = self.check_file_refactoring(fn)
277 self.assertTrue(data.startswith(codecs.BOM_UTF8)) 281 self.assertTrue(data.startswith(codecs.BOM_UTF8))
278 282
279 def test_crlf_newlines(self): 283 def test_crlf_newlines(self):
280 old_sep = os.linesep 284 old_sep = os.linesep
281 os.linesep = "\r\n" 285 os.linesep = "\r\n"
282 try: 286 try:
(...skipping 25 matching lines...) Expand all
308 312
309 rt = self.rt(fixers=["myfixes.fix_explicit"]) 313 rt = self.rt(fixers=["myfixes.fix_explicit"])
310 self.assertEqual(len(rt.post_order), 0) 314 self.assertEqual(len(rt.post_order), 0)
311 315
312 rt = self.rt(explicit=["myfixes.fix_explicit"]) 316 rt = self.rt(explicit=["myfixes.fix_explicit"])
313 for fix in rt.post_order: 317 for fix in rt.post_order:
314 if isinstance(fix, FixExplicit): 318 if isinstance(fix, FixExplicit):
315 break 319 break
316 else: 320 else:
317 self.fail("explicit fixer not loaded") 321 self.fail("explicit fixer not loaded")
OLDNEW
« no previous file with comments | « Lib/lib2to3/tests/data/false_encoding.py ('k') | Lib/test/test_importlib/source/test_source_encoding.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+