Created
December 27, 2011 01:40
-
-
Save startling/1522520 to your computer and use it in GitHub Desktop.
2to3's changes to cytoplasm.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RefactoringTool: Skipping implicit fixer: buffer | |
RefactoringTool: Skipping implicit fixer: idioms | |
RefactoringTool: Skipping implicit fixer: set_literal | |
RefactoringTool: Skipping implicit fixer: ws_comma | |
RefactoringTool: Refactored test.py | |
--- test.py (original) | |
+++ test.py (refactored) | |
@@ -1,4 +1,4 @@ | |
-import os, imp, shutil, urllib2 | |
+import os, imp, shutil, urllib.request, urllib.error, urllib.parse | |
import nose, mako, multiprocessing | |
import cytoplasm | |
from cytoplasm import server | |
@@ -45,9 +45,9 @@ | |
# a filter to tell whether files are html files and are not configuration files. | |
filter = lambda x: x.endswith(".html") and not x.startswith("_") | |
# the html files in the source directory: | |
- in_source_dir = [file for file in self.directory if filter(file)] | |
+ in_source_dir = [file for file in self.directory if list(filter(file))] | |
# the html files in the build dir: | |
- in_build_dir = [file for file in self.build_dir if filter(file)] | |
+ in_build_dir = [file for file in self.build_dir if list(filter(file))] | |
# If nothing bad has happened, both of these lists should be equal. | |
assert in_source_dir == in_build_dir | |
# Furthermore, the contents of each of these files should be the same. | |
@@ -102,8 +102,8 @@ | |
# for each of the html files in the build directory... | |
for file in [file for file in os.listdir(self.build_dir) if file.endswith(".html")]: | |
# Make an http request to the server and get the response. | |
- req = urllib2.Request("http://localhost:8092/%s" %(file)) | |
- response = urllib2.urlopen(req) | |
+ req = urllib.request.Request("http://localhost:8092/%s" %(file)) | |
+ response = urllib.request.urlopen(req) | |
# assert that the contents of the http response are the same as the html file that it | |
# should correspond too. | |
assert response.read() == open(os.path.join(self.build_dir, file)).read() | |
RefactoringTool: Files that were modified: | |
RefactoringTool: test.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment