summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2013-02-07 23:04:37 +0000
committerMarius Gedminas <marius@gedmin.as>2013-02-07 23:04:37 +0000
commit5d55155c2357e456ac7b3ec1b317915ccf9221b4 (patch)
tree8922ae821fcaf01b5365413f4b8706311c362c76 /src
parent01bc8e08c131100fe46695fff96760a8d501115c (diff)
downloadzope-tal-5d55155c2357e456ac7b3ec1b317915ccf9221b4.tar.gz
Towards Py3K: avoid deprecated assertion spellings
Diffstat (limited to 'src')
-rw-r--r--src/zope/tal/tests/test_htmltalparser.py12
-rw-r--r--src/zope/tal/tests/test_talgettext.py4
-rw-r--r--src/zope/tal/tests/test_talinterpreter.py18
-rw-r--r--src/zope/tal/tests/test_xmlparser.py6
4 files changed, 20 insertions, 20 deletions
diff --git a/src/zope/tal/tests/test_htmltalparser.py b/src/zope/tal/tests/test_htmltalparser.py
index d88bd74..851f80f 100644
--- a/src/zope/tal/tests/test_htmltalparser.py
+++ b/src/zope/tal/tests/test_htmltalparser.py
@@ -44,12 +44,12 @@ class TestCaseBase(unittest.TestCase):
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):
diff --git a/src/zope/tal/tests/test_talgettext.py b/src/zope/tal/tests/test_talgettext.py
index f0e9ce8..2b16938 100644
--- a/src/zope/tal/tests/test_talgettext.py
+++ b/src/zope/tal/tests/test_talgettext.py
@@ -36,7 +36,7 @@ class test_POEngine(unittest.TestCase):
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 @@ class test_POEngine(unittest.TestCase):
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.'])
diff --git a/src/zope/tal/tests/test_talinterpreter.py b/src/zope/tal/tests/test_talinterpreter.py
index 2e630f0..c8dcfce 100644
--- a/src/zope/tal/tests/test_talinterpreter.py
+++ b/src/zope/tal/tests/test_talinterpreter.py
@@ -740,7 +740,7 @@ class TestSourceAnnotations(unittest.TestCase):
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 @@ class TestSourceAnnotations(unittest.TestCase):
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 @@ class TestSourceAnnotations(unittest.TestCase):
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 @@ class TestErrorTracebacks(TestCaseBase):
# 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 @@ class TestErrorTracebacks(TestCaseBase):
# 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))
diff --git a/src/zope/tal/tests/test_xmlparser.py b/src/zope/tal/tests/test_xmlparser.py
index c8ab0c6..530a938 100644
--- a/src/zope/tal/tests/test_xmlparser.py
+++ b/src/zope/tal/tests/test_xmlparser.py
@@ -102,7 +102,7 @@ class XMLParserTestCase(unittest.TestCase):
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 @@ text
])
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")