[Checkins] SVN: zope.proxy/trunk/ Further test cleanup.

Tres Seaver cvs-admin at zope.org
Wed Jun 6 20:12:40 UTC 2012


Log message for revision 126613:
  Further test cleanup.

Changed:
  _U  zope.proxy/trunk/
  U   zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py

-=-
Modified: zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py
===================================================================
--- zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py	2012-06-06 20:12:33 UTC (rev 126612)
+++ zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py	2012-06-06 20:12:37 UTC (rev 126613)
@@ -32,10 +32,6 @@
         from zope.proxy import ProxyBase
         return ProxyBase
 
-    def setUp(self):
-        self.x = Thing()
-        self.p = self.new_proxy(self.x)
-
     def new_proxy(self, o):
         return self.proxy_class(o)
 
@@ -81,6 +77,8 @@
         self.assertEquals(list(p), list('another'))
 
     def test_proxy_attributes(self):
+        class Thing:
+            """This class is expected to be a classic class."""
         o = Thing()
         o.foo = 1
         w = self.new_proxy(o)
@@ -96,6 +94,8 @@
         from zope.proxy._compat import PY3
         # Proxies of old-style classes can't be pickled.
         if not PY3: # No old-style classes in Python 3.
+            class Thing:
+                """This class is expected to be a classic class."""
             w = self.new_proxy(Thing())
             self.assertRaises(pickle.PicklingError,
                             pickle.dumps, w)
@@ -758,34 +758,24 @@
         self.assertEqual(proxy.what(), 'PROXY')
 
 
-class Thing:
-    """This class is expected to be a classic class."""
-
-
 class Comparable(object):
     def __init__(self, value):
         self.value = value
 
     def __eq__(self, other):
-        if hasattr(other, "value"):
-            other = other.value
-        return self.value == other
+        return self.value == getattr(other, 'value', other)
 
     def __ne__(self, other):
         return not self.__eq__(other)
 
     def __lt__(self, other):
-        if hasattr(other, "value"):
-            other = other.value
-        return self.value < other
+        return self.value < getattr(other, 'value', other)
 
     def __ge__(self, other):
         return not self.__lt__(other)
 
     def __le__(self, other):
-        if hasattr(other, "value"):
-            other = other.value
-        return self.value <= other
+        return self.value <= getattr(other, 'value', other)
 
     def __gt__(self, other):
         return not self.__le__(other)
@@ -795,7 +785,6 @@
 
 
 def test_suite():
-    from doctest import DocTestSuite
     return unittest.TestSuite((
         unittest.makeSuite(ModuleConformanceCase),
         unittest.makeSuite(ProxyBaseTestCase),
@@ -807,5 +796,4 @@
         unittest.makeSuite(Test_queryInnerProxy),
         unittest.makeSuite(Test_sameProxiedObjects),
         unittest.makeSuite(Test_nonOverridable),
-        DocTestSuite(),
     ))



More information about the checkins mailing list