[Python-checkins] r42122 - python/branches/release24-maint/Lib/unittest.py

georg.brandl python-checkins at python.org
Fri Jan 20 22:08:57 CET 2006


Author: georg.brandl
Date: Fri Jan 20 22:08:54 2006
New Revision: 42122

Modified:
   python/branches/release24-maint/Lib/unittest.py
Log:
Reverse checkin. This is definitely a new feature.



Modified: python/branches/release24-maint/Lib/unittest.py
==============================================================================
--- python/branches/release24-maint/Lib/unittest.py	(original)
+++ python/branches/release24-maint/Lib/unittest.py	Fri Jan 20 22:08:54 2006
@@ -201,9 +201,9 @@
            not have a method with the specified name.
         """
         try:
-            self._testMethodName = methodName
+            self.__testMethodName = methodName
             testMethod = getattr(self, methodName)
-            self._testMethodDoc = testMethod.__doc__
+            self.__testMethodDoc = testMethod.__doc__
         except AttributeError:
             raise ValueError, "no such test method in %s: %s" % \
                   (self.__class__, methodName)
@@ -229,30 +229,30 @@
         The default implementation of this method returns the first line of
         the specified test method's docstring.
         """
-        doc = self._testMethodDoc
+        doc = self.__testMethodDoc
         return doc and doc.split("\n")[0].strip() or None
 
     def id(self):
-        return "%s.%s" % (_strclass(self.__class__), self._testMethodName)
+        return "%s.%s" % (_strclass(self.__class__), self.__testMethodName)
 
     def __str__(self):
-        return "%s (%s)" % (self._testMethodName, _strclass(self.__class__))
+        return "%s (%s)" % (self.__testMethodName, _strclass(self.__class__))
 
     def __repr__(self):
         return "<%s testMethod=%s>" % \
-               (_strclass(self.__class__), self._testMethodName)
+               (_strclass(self.__class__), self.__testMethodName)
 
     def run(self, result=None):
         if result is None: result = self.defaultTestResult()
         result.startTest(self)
-        testMethod = getattr(self, self._testMethodName)
+        testMethod = getattr(self, self.__testMethodName)
         try:
             try:
                 self.setUp()
             except KeyboardInterrupt:
                 raise
             except:
-                result.addError(self, self._exc_info())
+                result.addError(self, self.__exc_info())
                 return
 
             ok = False
@@ -260,18 +260,18 @@
                 testMethod()
                 ok = True
             except self.failureException:
-                result.addFailure(self, self._exc_info())
+                result.addFailure(self, self.__exc_info())
             except KeyboardInterrupt:
                 raise
             except:
-                result.addError(self, self._exc_info())
+                result.addError(self, self.__exc_info())
 
             try:
                 self.tearDown()
             except KeyboardInterrupt:
                 raise
             except:
-                result.addError(self, self._exc_info())
+                result.addError(self, self.__exc_info())
                 ok = False
             if ok: result.addSuccess(self)
         finally:
@@ -283,10 +283,10 @@
     def debug(self):
         """Run the test without collecting errors in a TestResult"""
         self.setUp()
-        getattr(self, self._testMethodName)()
+        getattr(self, self.__testMethodName)()
         self.tearDown()
 
-    def _exc_info(self):
+    def __exc_info(self):
         """Return a version of sys.exc_info() with the traceback frame
            minimised; usually the top level of the traceback frame is not
            needed.


More information about the Python-checkins mailing list