mirror of https://github.com/python/cpython.git
revert unintended changes
This commit is contained in:
parent
e26f482742
commit
8c05568e06
|
@ -500,7 +500,7 @@ def traverse_by(self, fixers, traversal):
|
|||
node = new
|
||||
|
||||
def processed_file(self, new_text, filename, old_text=None, write=False,
|
||||
encoding=None, newlines=None):
|
||||
encoding=None):
|
||||
"""
|
||||
Called when a file has been refactored, and there are changes.
|
||||
"""
|
||||
|
|
|
@ -231,23 +231,6 @@ def mock_refactor_file(self, f, *args):
|
|||
os.path.join("a_dir", "stuff.py")]
|
||||
check(tree, tree)
|
||||
|
||||
def test_preserve_file_newlines(self):
|
||||
rt = self.rt(fixers=_2TO3_FIXERS)
|
||||
for nl in ("\r\n", "\n"):
|
||||
data = "print y%s%syes%sok%s" % ((nl,) * 4)
|
||||
handle, tmp = tempfile.mkstemp()
|
||||
os.close(handle)
|
||||
try:
|
||||
with open(tmp, "w") as fp:
|
||||
fp.write(data)
|
||||
rt.refactor_file(tmp)
|
||||
with open(tmp, "r") as fp:
|
||||
contents = fp.read()
|
||||
finally:
|
||||
os.unlink(tmp)
|
||||
for line in contents.splitlines(True):
|
||||
self.assertTrue(line.endswith(nl))
|
||||
|
||||
def test_file_encoding(self):
|
||||
fn = os.path.join(TEST_DATA_DIR, "different_encoding.py")
|
||||
self.check_file_refactoring(fn)
|
||||
|
|
Loading…
Reference in New Issue