[Checkins] SVN: Products.CMFUid/trunk/Products/CMFUid/tests/test_uid unittest cleanup:

Yvo Schubbe cvs-admin at zope.org
Sun Apr 22 11:05:18 UTC 2012


Log message for revision 125231:
  unittest cleanup:
  - replaced deprecated assert method aliases
  - PEP 8

Changed:
  U   Products.CMFUid/trunk/Products/CMFUid/tests/test_uidannotation.py
  U   Products.CMFUid/trunk/Products/CMFUid/tests/test_uidgeneration.py

-=-
Modified: Products.CMFUid/trunk/Products/CMFUid/tests/test_uidannotation.py
===================================================================
--- Products.CMFUid/trunk/Products/CMFUid/tests/test_uidannotation.py	2012-04-22 11:04:41 UTC (rev 125230)
+++ Products.CMFUid/trunk/Products/CMFUid/tests/test_uidannotation.py	2012-04-22 11:05:15 UTC (rev 125231)
@@ -92,11 +92,7 @@
 
         transaction.savepoint(optimistic=True)
 
-    def _initPolicyAndUser(self
-                          , a_lambda=None
-                          , v_lambda=None
-                          , c_lambda=None
-                          ):
+    def _initPolicyAndUser(self, a_lambda=None, v_lambda=None, c_lambda=None):
 
         def _promiscuous(*args, **kw):
             return 1
@@ -112,8 +108,8 @@
 
         scp = _SensitiveSecurityPolicy(v_lambda, c_lambda)
         SecurityManager.setSecurityPolicy(scp)
-        newSecurityManager(None
-                          , _AllowedUser(a_lambda).__of__(self.app.acl_users))
+        newSecurityManager(None,
+                           _AllowedUser(a_lambda).__of__(self.app.acl_users))
 
     def test_interfaces(self):
         from Products.CMFUid.interfaces import IUniqueIdAnnotation
@@ -153,7 +149,7 @@
 
         annotation = getattr(dummy, UID_ATTRNAME, None)
 
-        self.failUnless(annotation is not None)
+        self.assertTrue(annotation is not None)
 
     def test_simulateItemAddRemovingUid(self):
         # an annotated object is set in place
@@ -170,7 +166,7 @@
         self.uidannotation.assign_on_add = True
         self.app._setObject('dummycontent', dummy)
 
-        self.failIf(getattr(dummy, UID_ATTRNAME)() == annotation())
+        self.assertFalse(getattr(dummy, UID_ATTRNAME)() == annotation())
 
     def test_simulateItemAddDoesNotTouchUid(self):
         # an annotated object is set in place
@@ -208,7 +204,8 @@
         cookie = site.manage_copyObjects(ids=['dummy'])
         self.app.folder1.manage_pasteObjects(cookie)
 
-        self.assertRaises(AttributeError, getattr, self.app.folder1.dummy, UID_ATTRNAME)
+        self.assertRaises(AttributeError, getattr, self.app.folder1.dummy,
+                          UID_ATTRNAME)
 
     def test_simulateItemCloneRemovingUid2(self):
         # an object is set in place, annotated and then copied
@@ -224,7 +221,8 @@
         cookie = site.manage_copyObjects(ids=['dummy'])
         self.app.folder1.manage_pasteObjects(cookie)
 
-        self.assertRaises(AttributeError, getattr, self.app.folder1.dummy, UID_ATTRNAME)
+        self.assertRaises(AttributeError, getattr, self.app.folder1.dummy,
+                          UID_ATTRNAME)
 
     def test_simulateItemCloneDoesNotTouchUid(self):
         # an object is set in place, annotated, and then copied
@@ -258,7 +256,7 @@
         self.app.folder1.manage_pasteObjects(cookie)
         new_annotation = getattr(self.app.folder1.dummy, UID_ATTRNAME)
 
-        self.failIf(annotation() == new_annotation())
+        self.assertFalse(annotation() == new_annotation())
 
     def test_simulateNestedFolderCloneRemovingUid1(self):
         self._initPolicyAndUser() # allow copy/paste operations
@@ -276,7 +274,8 @@
         cookie = self.app.site.manage_copyObjects(ids='foo')
         self.app.site.foo2.manage_pasteObjects(cookie)
 
-        self.assertRaises(AttributeError, getattr, self.app.site.foo2.foo.sub1.sub2.baz, UID_ATTRNAME)
+        self.assertRaises(AttributeError, getattr,
+                          self.app.site.foo2.foo.sub1.sub2.baz, UID_ATTRNAME)
 
 
 def test_suite():

Modified: Products.CMFUid/trunk/Products/CMFUid/tests/test_uidgeneration.py
===================================================================
--- Products.CMFUid/trunk/Products/CMFUid/tests/test_uidgeneration.py	2012-04-22 11:04:41 UTC (rev 125230)
+++ Products.CMFUid/trunk/Products/CMFUid/tests/test_uidgeneration.py	2012-04-22 11:05:15 UTC (rev 125231)
@@ -42,8 +42,8 @@
         generator = self._makeOne()
         uid1 = generator()
         uid2 = generator()
-        self.failIfEqual(uid1, uid2)
-        self.failIfEqual(uid1, None)
+        self.assertNotEqual(uid1, uid2)
+        self.assertNotEqual(uid1, None)
 
     def test_converter(self):
         generator = self._makeOne()
@@ -59,10 +59,10 @@
         generator = self._makeOne()
         uid1 = generator()
         generator._uid_counter = Length(uid1)
-        self.failUnless(isinstance(generator._uid_counter, Length))
+        self.assertTrue(isinstance(generator._uid_counter, Length))
         uid2 = generator()
-        self.failUnless(isinstance(generator._uid_counter, int))
-        self.failIfEqual(uid1, uid2)
+        self.assertTrue(isinstance(generator._uid_counter, int))
+        self.assertNotEqual(uid1, uid2)
 
 
 def test_suite():



More information about the checkins mailing list