Tetsuya Morimoto avatar Tetsuya Morimoto committed 7d39f19

changed to avoid using print-as-a-function
fixed a trivial comment typo

Comments (0)

Files changed (1)

 constructor).  These are all the core parts of a mock library.  The
 implementation is simple because most of the work is done by doctest.
 """
-from __future__ import print_function
 
 __all__ = ["mock", "restore", "Mock", "TraceTracker", "assert_same_trace"]
 
 import textwrap
 
 try:
-    # for Python 3
+    # for Python 2.6 or later
     import __builtin__ as builtins
     from StringIO import StringIO
 except ImportError:
-    # for Python 2.6 or later
+    # for Python 3
     import builtins
     from io import StringIO
 
         parts = [repr(a) for a in args]
         parts.extend(
             '%s=%r' % (items) for items in sorted(kw.items()))
-        msg = 'Called %s(%s)' % (func_name, ', '.join(parts))
+        msg = 'Called %s(%s)\n' % (func_name, ', '.join(parts))
         if len(msg) > 80:
-            msg = 'Called %s(\n    %s)' % (
+            msg = 'Called %s(\n    %s)\n' % (
                 func_name, ',\n    '.join(parts))
-        print(msg, file=self.file)
+        self.file.write(msg)
 
     def set(self, obj_name, attr, value): 
         """
         >>> z.a = 2
         Set z.a = 2
         """
-        print('Set %s.%s = %r' % (obj_name, attr, value), file=self.file)
+        self.file.write('Set %s.%s = %r\n' % (obj_name, attr, value))
         
 class TraceTracker(Printer):
     """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.