Log message for revision 115556:
  Updated the remaining test assertions
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/OFS/tests/testFileAndImage.py
  U   Zope/trunk/src/OFS/tests/testOrderSupport.py
  U   Zope/trunk/src/OFS/tests/testTraverse.py
  U   Zope/trunk/src/OFS/tests/test_userfolder.py
  U   Zope/trunk/src/Products/PageTemplates/tests/test_ptfile.py
  U   Zope/trunk/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
  U   Zope/trunk/src/Products/Transience/tests/testTransientObject.py
  U   Zope/trunk/src/Testing/ZopeTestCase/testBaseTestCase.py
  U   Zope/trunk/src/Testing/ZopeTestCase/testZODBCompat.py
  U   Zope/trunk/src/ZPublisher/tests/testBaseRequest.py
  U   Zope/trunk/src/ZPublisher/tests/test_mapply.py
  U   Zope/trunk/src/Zope2/Startup/tests/testStarter.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst  2010-08-08 15:59:27 UTC (rev 115555)
+++ Zope/trunk/doc/CHANGES.rst  2010-08-08 16:04:39 UTC (rev 115556)
@@ -15,9 +15,9 @@
 Features Added
 ++++++++++++++
 
-- Replaced failUnless with assertTrue and failIf with assertFalse in tests.
+- Updated test assertions to use unittest's ``assert*`` methods in favor of
+  their deprecated `fail*` aliases.
 
-
 2.13.0a3 (2010-08-04)
 ---------------------
 

Modified: Zope/trunk/src/OFS/tests/testFileAndImage.py
===================================================================
--- Zope/trunk/src/OFS/tests/testFileAndImage.py        2010-08-08 15:59:27 UTC 
(rev 115555)
+++ Zope/trunk/src/OFS/tests/testFileAndImage.py        2010-08-08 16:04:39 UTC 
(rev 115556)
@@ -195,10 +195,10 @@
         # From a file
         s = "a" * (1 << 16) * 3
         data, size = self.file._read_data(StringIO(s))
-        self.failIfEqual(data.next, None)
+        self.assertNotEqual(data.next, None)
         # From a string
         data, size = self.file._read_data(s)
-        self.failIfEqual(data.next, None)
+        self.assertNotEqual(data.next, None)
 
     def testManageEditWithFileData(self):
         self.file.manage_edit('foobar', 'text/plain', filedata='ASD')

Modified: Zope/trunk/src/OFS/tests/testOrderSupport.py
===================================================================
--- Zope/trunk/src/OFS/tests/testOrderSupport.py        2010-08-08 15:59:27 UTC 
(rev 115555)
+++ Zope/trunk/src/OFS/tests/testOrderSupport.py        2010-08-08 16:04:39 UTC 
(rev 115556)
@@ -54,10 +54,10 @@
             f = self._makeOne()
             method = getattr(f, methodname)
             if rval == 'ValueError':
-                self.failUnlessRaises( ValueError, method, *args )
+                self.assertRaises( ValueError, method, *args )
             else:
-                self.failUnlessEqual( method(*args), rval )
-            self.failUnlessEqual( f.objectIds(), order )
+                self.assertEqual( method(*args), rval )
+            self.assertEqual( f.objectIds(), order )
 
     def test_moveObjectsUp(self):
         self._doCanonTest( 'moveObjectsUp',
@@ -157,13 +157,13 @@
         f.o2.isPrincipiaFolderish = True
         f.o3.isPrincipiaFolderish = True
         f.o4.isPrincipiaFolderish = True
-        self.failUnlessEqual( f.tpValues(), [f.o2, f.o3, f.o4] )
+        self.assertEqual( f.tpValues(), [f.o2, f.o3, f.o4] )
 
         f.setDefaultSorting('meta_type', False)
-        self.failUnlessEqual( f.tpValues(), [f.o3, f.o2, f.o4] )
+        self.assertEqual( f.tpValues(), [f.o3, f.o2, f.o4] )
 
         f.setDefaultSorting('position', True)
-        self.failUnlessEqual( f.tpValues(), [f.o4, f.o3, f.o2] )
+        self.assertEqual( f.tpValues(), [f.o4, f.o3, f.o2] )
 
 
 def test_suite():

Modified: Zope/trunk/src/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/src/OFS/tests/testTraverse.py    2010-08-08 15:59:27 UTC (rev 
115555)
+++ Zope/trunk/src/OFS/tests/testTraverse.py    2010-08-08 16:04:39 UTC (rev 
115556)
@@ -248,12 +248,12 @@
         self.assertTrue(self.folder1.unrestrictedTraverse( '/folder1/'))
 
     def testTraverseToNone( self ):
-        self.failUnlessRaises(
+        self.assertRaises(
             KeyError,
             self.folder1.unrestrictedTraverse, ('', 'folder1', 'file2' ) )
-        self.failUnlessRaises(
+        self.assertRaises(
             KeyError, self.folder1.unrestrictedTraverse,  '/folder1/file2' )
-        self.failUnlessRaises(
+        self.assertRaises(
             KeyError, self.folder1.unrestrictedTraverse,  '/folder1/file2/' )
 
     def testTraverseMethodRestricted(self):
@@ -272,7 +272,7 @@
         # Zope security policy.
         self._setupSecurity()
         bb = self._makeBoboTraversable()
-        self.failUnlessRaises(KeyError, bb.restrictedTraverse, 'notfound')
+        self.assertRaises(KeyError, bb.restrictedTraverse, 'notfound')
         bb.restrictedTraverse('bb_subitem')
 
     def testBoboTraverseToMethod(self):
@@ -323,7 +323,7 @@
         folder.manage_permission(access_contents_information, [], 0)
         bb = self._makeBoboTraversableWithAcquisition()
         bb = bb.__of__(self.root)
-        self.failUnlessRaises(Unauthorized,
+        self.assertRaises(Unauthorized,
                               bb.restrictedTraverse, 'folder1')
 
     def testBoboTraverseToAcquiredAttribute(self):
@@ -349,7 +349,7 @@
         folder.stuff = 'stuff here'
         bb = self._makeBoboTraversableWithAcquisition()
         bb = bb.__of__(folder)
-        self.failUnlessRaises(Unauthorized,
+        self.assertRaises(Unauthorized,
                               self.root.folder1.restrictedTraverse, 'stuff')
 
     def testBoboTraverseTraversalDefault(self):
@@ -389,7 +389,7 @@
         self._setupSecurity(CruelSecurityPolicy())
         newSecurityManager( None, self._makeUser().__of__( self.root ) )
         self.root.stuff = 'stuff here'
-        self.failUnlessRaises(Unauthorized,
+        self.assertRaises(Unauthorized,
                               self.app.folder1.restrictedTraverse, 'stuff')
 
     def testDefaultValueWhenUnathorized(self):

Modified: Zope/trunk/src/OFS/tests/test_userfolder.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_userfolder.py 2010-08-08 15:59:27 UTC (rev 
115555)
+++ Zope/trunk/src/OFS/tests/test_userfolder.py 2010-08-08 16:04:39 UTC (rev 
115556)
@@ -123,7 +123,7 @@
         uf = self._makeOne(app)
         user = uf.validate(app.REQUEST, self._makeBasicAuthToken(),
                            ['role1'])
-        self.failIfEqual(user, None)
+        self.assertNotEqual(user, None)
         self.assertEqual(user.getUserName(), 'user1')
 
     def testNotValidateWithoutAuth(self):

Modified: Zope/trunk/src/Products/PageTemplates/tests/test_ptfile.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/tests/test_ptfile.py  2010-08-08 
15:59:27 UTC (rev 115555)
+++ Zope/trunk/src/Products/PageTemplates/tests/test_ptfile.py  2010-08-08 
16:04:39 UTC (rev 115556)
@@ -135,7 +135,7 @@
         f.close()
         pt = PageTemplateFile(self.TEMPFILENAME)
         pt_id = pt.getId()
-        self.failUnlessEqual(
+        self.assertEqual(
                 pt_id, desired_id,
                 'getId() returned %r. Expecting %r' % (pt_id, desired_id)
                 )
@@ -148,7 +148,7 @@
         f.close()
         pt = PageTemplateFile(self.TEMPFILENAME)
         pt_path = pt.getPhysicalPath()
-        self.failUnlessEqual(
+        self.assertEqual(
                 pt_path, desired_path,
                 'getPhysicalPath() returned %r. Expecting %r' % (
                     desired_path, pt_path,

Modified: 
Zope/trunk/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py     
2010-08-08 15:59:27 UTC (rev 115555)
+++ Zope/trunk/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py     
2010-08-08 16:04:39 UTC (rev 115556)
@@ -136,8 +136,8 @@
         result, used = index._apply_index(req)
         if hasattr(result, 'keys'):
             result = result.keys()
-        self.failUnlessEqual(used, ('date',))
-        self.failUnlessEqual(len(result), len(expectedValues),
+        self.assertEqual(used, ('date',))
+        self.assertEqual(len(result), len(expectedValues),
             '%s | %s' % (result, expectedValues))
         for k, v in expectedValues:
             self.assertTrue(k in result)
@@ -175,8 +175,8 @@
         from DateTime import DateTime
         index = self._makeOne()
 
-        self.failUnlessEqual(len(index), 0)
-        self.failUnlessEqual(len(index.referencedObjects()), 0)
+        self.assertEqual(len(index), 0)
+        self.assertEqual(len(index.referencedObjects()), 0)
 
         self.assertTrue(index.getEntryForObject(1234) is None)
         marker = []
@@ -185,7 +185,7 @@
 
         self.assertTrue(index.hasUniqueValuesFor('date'))
         self.assertFalse(index.hasUniqueValuesFor('foo'))
-        self.failUnlessEqual(len(index.uniqueValues('date')), 0)
+        self.assertEqual(len(index.uniqueValues('date')), 0)
 
         self.assertTrue(index._apply_index({'zed': 12345}) is None)
 
@@ -211,8 +211,8 @@
         self._populateIndex(index)
         values = self._getValues()
 
-        self.failUnlessEqual(len(index), len(values) - 2) # One dupe, one empty
-        self.failUnlessEqual(len(index.referencedObjects()), len(values) - 1)
+        self.assertEqual(len(index), len(values) - 2) # One dupe, one empty
+        self.assertEqual(len(index.referencedObjects()), len(values) - 1)
             # One empty
 
         self.assertTrue(index.getEntryForObject(1234) is None)
@@ -222,10 +222,10 @@
 
         for k, v in values:
             if v.date():
-                self.failUnlessEqual(index.getEntryForObject(k),
+                self.assertEqual(index.getEntryForObject(k),
                     self._convert(v.date()))
 
-        self.failUnlessEqual(len(index.uniqueValues('date')), len(values) - 2)
+        self.assertEqual(len(index.uniqueValues('date')), len(values) - 2)
         self.assertTrue(index._apply_index({'bar': 123}) is None)
 
         self._checkApply(index,
@@ -258,7 +258,7 @@
             # and still correct for item 10
             yr, mo, dy, hr, mn = v.date().utctimetuple()[:5]
             val = (((yr * 12 + mo) * 31 + dy) * 24 + hr) * 60 + mn
-            self.failUnlessEqual(index.getEntryForObject(k), val)
+            self.assertEqual(index.getEntryForObject(k), val)
 
     def test_removal(self):
         """ DateIndex would hand back spurious entries when used as a

Modified: Zope/trunk/src/Products/Transience/tests/testTransientObject.py
===================================================================
--- Zope/trunk/src/Products/Transience/tests/testTransientObject.py     
2010-08-08 15:59:27 UTC (rev 115555)
+++ Zope/trunk/src/Products/Transience/tests/testTransientObject.py     
2010-08-08 16:04:39 UTC (rev 115556)
@@ -36,7 +36,7 @@
 
     def test_id(self):
         t = self.t.new('xyzzy')
-        self.failIfEqual(t.getId(), 'xyzzy') # dont acquire
+        self.assertNotEqual(t.getId(), 'xyzzy') # dont acquire
         self.assertEqual(t.getContainerKey(), 'xyzzy')
 
     def test_validate(self):
@@ -62,12 +62,12 @@
     def test_getLastModifiedSet(self):
         t = self.t.new('xyzzy')
         t['a'] = 1
-        self.failIfEqual(t.getLastModified(), None)
+        self.assertNotEqual(t.getLastModified(), None)
 
     def testSetLastModified(self):
         t = self.t.new('xyzzy')
         t.setLastModified()
-        self.failIfEqual(t.getLastModified(), None)
+        self.assertNotEqual(t.getLastModified(), None)
 
     def test_setLastAccessed(self):
         t = self.t.new('xyzzy')

Modified: Zope/trunk/src/Testing/ZopeTestCase/testBaseTestCase.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/testBaseTestCase.py     2010-08-08 
15:59:27 UTC (rev 115555)
+++ Zope/trunk/src/Testing/ZopeTestCase/testBaseTestCase.py     2010-08-08 
16:04:39 UTC (rev 115556)
@@ -372,17 +372,17 @@
 
     def testRequestVariables(self):
         request = self.app.REQUEST
-        self.failIfEqual(request.get('SERVER_NAME', ''), '')
-        self.failIfEqual(request.get('SERVER_PORT', ''), '')
-        self.failIfEqual(request.get('REQUEST_METHOD', ''), '')
-        self.failIfEqual(request.get('URL', ''), '')
-        self.failIfEqual(request.get('SERVER_URL', ''), '')
-        self.failIfEqual(request.get('URL0', ''), '')
-        self.failIfEqual(request.get('URL1', ''), '')
-        self.failIfEqual(request.get('BASE0', ''), '')
-        self.failIfEqual(request.get('BASE1', ''), '')
-        self.failIfEqual(request.get('BASE2', ''), '')
-        self.failIfEqual(request.get('ACTUAL_URL', ''), '')
+        self.assertNotEqual(request.get('SERVER_NAME', ''), '')
+        self.assertNotEqual(request.get('SERVER_PORT', ''), '')
+        self.assertNotEqual(request.get('REQUEST_METHOD', ''), '')
+        self.assertNotEqual(request.get('URL', ''), '')
+        self.assertNotEqual(request.get('SERVER_URL', ''), '')
+        self.assertNotEqual(request.get('URL0', ''), '')
+        self.assertNotEqual(request.get('URL1', ''), '')
+        self.assertNotEqual(request.get('BASE0', ''), '')
+        self.assertNotEqual(request.get('BASE1', ''), '')
+        self.assertNotEqual(request.get('BASE2', ''), '')
+        self.assertNotEqual(request.get('ACTUAL_URL', ''), '')
 
 
 import gc

Modified: Zope/trunk/src/Testing/ZopeTestCase/testZODBCompat.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/testZODBCompat.py       2010-08-08 
15:59:27 UTC (rev 115555)
+++ Zope/trunk/src/Testing/ZopeTestCase/testZODBCompat.py       2010-08-08 
16:04:39 UTC (rev 115556)
@@ -70,7 +70,7 @@
         # _p_oids are None until we commit a subtransaction
         self.assertEqual(self.folder._p_oid, None)
         transaction.savepoint(optimistic=True)
-        self.failIfEqual(self.folder._p_oid, None)
+        self.assertNotEqual(self.folder._p_oid, None)
 
     def testCutPaste(self):
         cb = self.folder.manage_cutObjects(['doc'])
@@ -121,7 +121,7 @@
         # _p_oids are None until we commit a subtransaction
         self.assertEqual(self.folder._p_oid, None)
         transaction.savepoint(optimistic=True)
-        self.failIfEqual(self.folder._p_oid, None)
+        self.assertNotEqual(self.folder._p_oid, None)
 
     def testExport(self):
         self.folder.manage_exportObject('doc')

Modified: Zope/trunk/src/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/testBaseRequest.py  2010-08-08 15:59:27 UTC 
(rev 115555)
+++ Zope/trunk/src/ZPublisher/tests/testBaseRequest.py  2010-08-08 16:04:39 UTC 
(rev 115556)
@@ -260,7 +260,7 @@
         folder._setObject('objWithBD', self._makeObjectWithBD())
         folder.objWithBD._default_path = ['']
         r = self._makeOne(root)
-        self.failUnlessRaises(NotFound, r.traverse, 'folder/objWithBD')
+        self.assertRaises(NotFound, r.traverse, 'folder/objWithBD')
 
     def test_traverse_withBBT_handles_AttributeError(self):
         # Test that if __bobo_traverse__ raises AttributeError
@@ -273,7 +273,7 @@
         obj.__bobo_traverse__ = _faux___bobo_traverse__
         folder._setObject('objWithBBT', obj)
         r = self._makeOne(root)
-        self.failUnlessRaises(NotFound, r.traverse,
+        self.assertRaises(NotFound, r.traverse,
                               'folder/objWithBBT/bbt_foo')
 
     def test_traverse_UseTraversalDefault(self):
@@ -309,7 +309,7 @@
         folder._setObject('objWithBDBBT', self._makeObjectWithBDBBT())
         folder.objWithBDBBT._default_path = ['xxx']
         r = self._makeOne(root)
-        self.failUnlessRaises(NotFound, r.traverse, 'folder/objWithBDBBT')
+        self.assertRaises(NotFound, r.traverse, 'folder/objWithBDBBT')
 
     def test_traverse_slash(self):
         root, folder = self._makeRootAndFolder()

Modified: Zope/trunk/src/ZPublisher/tests/test_mapply.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/test_mapply.py      2010-08-08 15:59:27 UTC 
(rev 115555)
+++ Zope/trunk/src/ZPublisher/tests/test_mapply.py      2010-08-08 16:04:39 UTC 
(rev 115556)
@@ -25,10 +25,10 @@
             return '%d%d%d' % (a, b, c)
         values = {'a':2, 'b':3, 'c':5}
         v = mapply(compute, (), values)
-        self.failUnlessEqual(v, '235')
+        self.assertEqual(v, '235')
 
         v = mapply(compute, (7,), values)
-        self.failUnlessEqual(v, '735')
+        self.assertEqual(v, '735')
 
     def testClass(self):
         values = {'a':2, 'b':3, 'c':5}
@@ -39,11 +39,11 @@
             compute = __call__
         cc = c()
         v = mapply(cc, (), values)
-        self.failUnlessEqual(v, '335')
+        self.assertEqual(v, '335')
 
         del values['c']
         v = mapply(cc.compute, (), values)
-        self.failUnlessEqual(v, '334')
+        self.assertEqual(v, '334')
 
         class c2:
             """Must be a classic class."""
@@ -51,7 +51,7 @@
         c2inst = c2()
         c2inst.__call__ = cc
         v = mapply(c2inst, (), values)
-        self.failUnlessEqual(v, '334')
+        self.assertEqual(v, '334')
 
     def testObjectWithCall(self):
         # Make sure that the __call__ of an object can also be another

Modified: Zope/trunk/src/Zope2/Startup/tests/testStarter.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/tests/testStarter.py   2010-08-08 15:59:27 UTC 
(rev 115555)
+++ Zope/trunk/src/Zope2/Startup/tests/testStarter.py   2010-08-08 16:04:39 UTC 
(rev 115556)
@@ -156,7 +156,7 @@
         # XXX need to check that log messages get written to
         # sys.stderr, not that the stream identity for the startup
         # handler matches
-        #self.failUnlessEqual(starter.startup_handler.stream, sys.stderr)
+        #self.assertEqual(starter.startup_handler.stream, sys.stderr)
         conf = self.load_config_text("""
             instancehome <<INSTANCE_HOME>>
             debug-mode off
@@ -172,7 +172,7 @@
         # XXX need to check that log messages get written to
         # sys.stderr, not that the stream identity for the startup
         # handler matches
-        #self.failIfEqual(starter.startup_handler.stream, sys.stderr)
+        #self.assertNotEqual(starter.startup_handler.stream, sys.stderr)
 
     def testSetupZServerThreads(self):
         conf = self.load_config_text("""
@@ -361,7 +361,7 @@
         try:
             starter = self.get_starter(conf)
             starter.setupInterpreter()
-            self.failUnlessEqual( sys.getcheckinterval() , newcheckinterval )
+            self.assertEqual( sys.getcheckinterval() , newcheckinterval )
         finally:
             sys.setcheckinterval(oldcheckinterval)
 
@@ -385,7 +385,7 @@
             f.close()
             configure(fname)
             new_config = getConfiguration()
-            self.failUnlessEqual(new_config.zserver_threads, 100)
+            self.assertEqual(new_config.zserver_threads, 100)
         finally:
             sys.argv = old_argv
             try:

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to