[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Removed assert
statements from test code. Assert statements
Jim Fulton
jim at zope.com
Tue Aug 3 12:25:34 EDT 2004
Log message for revision 26878:
Removed assert statements from test code. Assert statements
don't belong in test code.
Changed:
U Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py
U Zope3/trunk/src/zope/app/fssync/tests/test_committer.py
U Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py
U Zope3/trunk/src/zope/app/i18n/tests/test_messagecatalog.py
U Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py
U Zope3/trunk/src/zope/app/sqlexpr/tests/test_sqlexpr.py
U Zope3/trunk/src/zope/fssync/tests/test_network.py
U Zope3/trunk/src/zope/i18n/tests/test_imessagecatalog.py
U Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py
U Zope3/trunk/src/zope/index/text/tests/test_textindexwrapper.py
U Zope3/trunk/src/zope/proxy/tests/test_proxy.py
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -41,7 +41,6 @@
_WidgetFactory = None
def setUpContent(self, desc=u'', title=u'Foo Title'):
- assert self._FieldFactory is not None
class ITestContent(Interface):
foo = self._FieldFactory(
title=title,
@@ -53,7 +52,6 @@
field = field.bind(self.content)
request = TestRequest(HTTP_ACCEPT_LANGUAGE='pl')
request.form['field.foo'] = u'Foo Value'
- assert self._WidgetFactory is not None
self._widget = self._WidgetFactory(field, request)
def setUp(self):
Modified: Zope3/trunk/src/zope/app/fssync/tests/test_committer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/test_committer.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/fssync/tests/test_committer.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -104,9 +104,11 @@
def setBody(self, body):
old = self.context
- assert old.__class__ is dict
+ if old.__class__ is not dict:
+ raise AssertionError("old.__class__ is not dict")
new = loads(body)
- assert type(new) is dict
+ if type(new) is not dict:
+ raise AssertionError("type(new) is not dict")
old.update(new)
for key in old.keys():
if key not in new:
Modified: Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -102,9 +102,9 @@
def testAddDeleteLanguage(self):
self._view.addLanguage('es')
- assert 'es' in self._view.getAllLanguages()
+ self.assert_('es' in self._view.getAllLanguages())
self._view.deleteLanguages(['es'])
- assert 'es' not in self._view.getAllLanguages()
+ self.assert_('es' not in self._view.getAllLanguages())
Modified: Zope3/trunk/src/zope/app/i18n/tests/test_messagecatalog.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/test_messagecatalog.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/i18n/tests/test_messagecatalog.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -35,8 +35,10 @@
def setUp(self):
self._catalog = self._getMessageCatalog()
- assert verifyObject(ILocalMessageCatalog, self._catalog)
+ def testInterface(self):
+ verifyObject(ILocalMessageCatalog, self._catalog)
+
def testGetFullMessage(self):
catalog = self._catalog
self.assertEqual(catalog.getFullMessage('short_greeting'),
Modified: Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -59,8 +59,9 @@
def setUp(self):
self._domain = self._getTranslationDomain()
- assert verifyObject(ITranslationDomain, self._domain)
+ def testInterface(self):
+ verifyObject(ITranslationDomain, self._domain)
def _getLanguages(self, domain):
languages = domain.getAllLanguages()
@@ -143,8 +144,9 @@
def setUp(self):
self._domain = self._getTranslationDomain()
- assert verifyObject(ISyncTranslationDomain, self._domain)
+ def testInterface(self):
+ verifyObject(ISyncTranslationDomain, self._domain)
def testGetMessagesMapping(self):
mapping = self._domain.getMessagesMapping(['de', 'en'],
Modified: Zope3/trunk/src/zope/app/sqlexpr/tests/test_sqlexpr.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlexpr/tests/test_sqlexpr.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/app/sqlexpr/tests/test_sqlexpr.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -60,7 +60,8 @@
(2, 'Foo Bar', 'foobar'))
def execute(self, operation, *args, **kw):
- assert operation == 'SELECT num FROM hitchhike'
+ if operation != 'SELECT num FROM hitchhike':
+ raise AssertionError(operation, 'SELECT num FROM hitchhike')
class TypeInfoStub(object):
Modified: Zope3/trunk/src/zope/fssync/tests/test_network.py
===================================================================
--- Zope3/trunk/src/zope/fssync/tests/test_network.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/fssync/tests/test_network.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -69,7 +69,8 @@
conn, addr = svr.accept()
##print "connect from", `addr`
else:
- assert s is conn
+ if s is not conn:
+ raise AssertionError("s is not conn")
data = conn.recv(1000)
##print "received", `data`
if not data:
Modified: Zope3/trunk/src/zope/i18n/tests/test_imessagecatalog.py
===================================================================
--- Zope3/trunk/src/zope/i18n/tests/test_imessagecatalog.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/i18n/tests/test_imessagecatalog.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -33,8 +33,9 @@
def setUp(self):
self._catalog = self._getMessageCatalog()
- assert verifyObject(IMessageCatalog, self._catalog)
+ def testInterface(self):
+ verifyObject(IMessageCatalog, self._catalog)
def testGetMessage(self):
catalog = self._catalog
Modified: Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -46,12 +46,14 @@
def setUp(self):
super(TestITranslationDomain, self).setUp()
self._domain = self._getTranslationDomain()
- assert verifyObject(ITranslationDomain, self._domain)
# Setup the negotiator utility
utilities = getService(Utilities)
utilities.provideUtility(INegotiator, negotiator)
+ def testInterface(self):
+ verifyObject(ITranslationDomain, self._domain)
+
def testSimpleTranslate(self):
translate = self._domain.translate
eq = self.assertEqual
Modified: Zope3/trunk/src/zope/index/text/tests/test_textindexwrapper.py
===================================================================
--- Zope3/trunk/src/zope/index/text/tests/test_textindexwrapper.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/index/text/tests/test_textindexwrapper.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -79,14 +79,14 @@
delta += u"\N{GREEK SMALL LETTER LAMDA}"
delta += u"\N{GREEK SMALL LETTER TAU}"
delta += u"\N{GREEK SMALL LETTER ALPHA}"
- assert delta.islower()
+ self.assert_(delta.islower())
emdash = u"\N{EM DASH}"
- assert not emdash.isalnum()
+ self.assert_(not emdash.isalnum())
alpha = u"\N{GREEK SMALL LETTER ALPHA}"
- assert alpha.islower()
+ self.assert_(alpha.islower())
lamda = u"\N{GREEK SMALL LETTER LAMDA}"
lamda += u"\N{GREEK SMALL LETTER ALPHA}"
- assert lamda.islower()
+ self.assert_(lamda.islower())
doc = delta + emdash + alpha
w.index_doc(1002, [doc])
for word in delta, alpha:
Modified: Zope3/trunk/src/zope/proxy/tests/test_proxy.py
===================================================================
--- Zope3/trunk/src/zope/proxy/tests/test_proxy.py 2004-08-03 15:58:54 UTC (rev 26877)
+++ Zope3/trunk/src/zope/proxy/tests/test_proxy.py 2004-08-03 16:25:34 UTC (rev 26878)
@@ -102,7 +102,8 @@
class MyProxy3(MyProxy2):
def __init__(self, arg):
- assert list(self) == list('value')
+ if list(self) != list('value'):
+ raise AssertionError("list(self) != list('value')")
super(MyProxy3, self).__init__('another')
p = MyProxy3('notused')
More information about the Zope3-Checkins
mailing list