[Checkins] SVN: zope.tal/trunk/src/zope/tal/tests/test_ Towards Py3K: avoid deprecated assertion spellings

Marius Gedminas cvs-admin at zope.org
Thu Feb 7 23:04:38 UTC 2013


Log message for revision 129188:
  Towards Py3K: avoid deprecated assertion spellings

Changed:
  U   zope.tal/trunk/src/zope/tal/tests/test_htmltalparser.py
  U   zope.tal/trunk/src/zope/tal/tests/test_talgettext.py
  U   zope.tal/trunk/src/zope/tal/tests/test_talinterpreter.py
  U   zope.tal/trunk/src/zope/tal/tests/test_xmlparser.py

-=-
Modified: zope.tal/trunk/src/zope/tal/tests/test_htmltalparser.py
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/test_htmltalparser.py	2013-02-07 23:04:33 UTC (rev 129187)
+++ zope.tal/trunk/src/zope/tal/tests/test_htmltalparser.py	2013-02-07 23:04:37 UTC (rev 129188)
@@ -44,12 +44,12 @@
         got_program, got_macros = parser.getCode()
         program = self._merge(self.initial_program, program)
         program = self._merge(program, self.final_program)
-        self.assert_(got_program == program,
-                     "Program:\n" + pprint.pformat(got_program)
-                     + "\nExpected:\n" + pprint.pformat(program))
-        self.assert_(got_macros == macros,
-                     "Macros:\n" + pprint.pformat(got_macros)
-                     + "\nExpected:\n" + pprint.pformat(macros))
+        self.assertEqual(got_program, program,
+                         "Program:\n" + pprint.pformat(got_program)
+                         + "\nExpected:\n" + pprint.pformat(program))
+        self.assertEqual(got_macros, macros,
+                         "Macros:\n" + pprint.pformat(got_macros)
+                         + "\nExpected:\n" + pprint.pformat(macros))
 
     def _should_error(self, source, exc=taldefs.TALError):
         def parse(self=self, source=source):

Modified: zope.tal/trunk/src/zope/tal/tests/test_talgettext.py
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/test_talgettext.py	2013-02-07 23:04:33 UTC (rev 129187)
+++ zope.tal/trunk/src/zope/tal/tests/test_talgettext.py	2013-02-07 23:04:37 UTC (rev 129188)
@@ -36,7 +36,7 @@
             engine.translate(key, 'domain')
 
         for key in test_keys:
-            self.failIf(key not in engine.catalog['domain'],
+            self.assertTrue(key in engine.catalog['domain'],
                         "POEngine catalog does not properly store message ids"
                         )
 
@@ -62,7 +62,7 @@
         for domain in engine.catalog.values():
             msgids += list(domain)
         msgids.sort()
-        self.assertEquals(msgids,
+        self.assertEqual(msgids,
             ['A <a href="${DYNAMIC_CONTENT}">link</a>.',
             'Some ${DYNAMIC_CONTENT} text.'])
 

Modified: zope.tal/trunk/src/zope/tal/tests/test_talinterpreter.py
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/test_talinterpreter.py	2013-02-07 23:04:33 UTC (rev 129187)
+++ zope.tal/trunk/src/zope/tal/tests/test_talinterpreter.py	2013-02-07 23:04:37 UTC (rev 129188)
@@ -740,7 +740,7 @@
         interpreter = self.interpreter
         interpreter.sourceFile = '/path/to/source.pt'
         interpreter.position = (123, 42)
-        self.assertEquals(interpreter.formatSourceAnnotation(),
+        self.assertEqual(interpreter.formatSourceAnnotation(),
             "<!--\n" +
             "=" * 78 + "\n" +
             "/path/to/source.pt (line 123)\n" +
@@ -751,7 +751,7 @@
         interpreter = self.interpreter
         interpreter.sourceFile = '/path/to/source.pt'
         interpreter.position = (None, None)
-        self.assertEquals(interpreter.formatSourceAnnotation(),
+        self.assertEqual(interpreter.formatSourceAnnotation(),
             "<!--\n" +
             "=" * 78 + "\n" +
             "/path/to/source.pt\n" +
@@ -776,11 +776,11 @@
             self.sio.truncate()
             interpreter._pending_source_annotation = True
             interpreter._annotated_stream_write(input)
-            self.assertEquals(self.sio.getvalue(), output)
+            self.assertEqual(self.sio.getvalue(), output)
             if '@' in output:
-                self.assert_(not interpreter._pending_source_annotation)
+                self.assertFalse(interpreter._pending_source_annotation)
             else:
-                self.assert_(interpreter._pending_source_annotation)
+                self.assertTrue(interpreter._pending_source_annotation)
 
 
 class TestErrorTracebacks(TestCaseBase):
@@ -806,8 +806,8 @@
         # Expect TALExpressionError: unknown variable: 'no_such_thing'
         self.assertRaises(TALExpressionError, interp)
         # Now the engine should know where the error occurred
-        self.assertEquals(engine.source_file, 'page.pt')
-        self.assertEquals(engine.position, (4, 16))
+        self.assertEqual(engine.source_file, 'page.pt')
+        self.assertEqual(engine.position, (4, 16))
 
     def test_define_slot_restores_source_file_if_no_exception(self):
         m_program, m_macros = self._compile("""
@@ -828,8 +828,8 @@
         # Expect TALExpressionError: unknown variable: 'no_such_thing'
         self.assertRaises(TALExpressionError, interp)
         # Now the engine should know where the error occurred
-        self.assertEquals(engine.source_file, 'macros.pt')
-        self.assertEquals(engine.position, (5, 14))
+        self.assertEqual(engine.source_file, 'macros.pt')
+        self.assertEqual(engine.position, (5, 14))
 
 
 

Modified: zope.tal/trunk/src/zope/tal/tests/test_xmlparser.py
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/test_xmlparser.py	2013-02-07 23:04:33 UTC (rev 129187)
+++ zope.tal/trunk/src/zope/tal/tests/test_xmlparser.py	2013-02-07 23:04:37 UTC (rev 129188)
@@ -102,7 +102,7 @@
             parser.parseStream(SegmentedFile(source))
         else:
             parser.parseString(source)
-        self.assertEquals(parser.get_events(),events)
+        self.assertEqual(parser.get_events(), events)
 
     def _run_check_extra(self, source, events):
         self._run_check(source, events, EventCollectorExtra)
@@ -158,8 +158,8 @@
                 ])
         except:
             e = sys.exc_info()[1]
-            self.assert_(e.lineno == 1,
-                         "did not receive correct position information")
+            self.assertEqual(e.lineno, 1,
+                             "did not receive correct position information")
         else:
             self.fail("expected parse error: bad nesting")
 



More information about the checkins mailing list