[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/OFS/tests/test Move new tests into existing unittest module.
Tres Seaver
tseaver at palladion.com
Mon Jan 11 16:47:29 EST 2010
Log message for revision 108034:
Move new tests into existing unittest module.
Changed:
U Zope/branches/2.9/lib/python/OFS/tests/testSimpleItem.py
D Zope/branches/2.9/lib/python/OFS/tests/test_SimpleItem.py
-=-
Modified: Zope/branches/2.9/lib/python/OFS/tests/testSimpleItem.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/tests/testSimpleItem.py 2010-01-11 21:36:17 UTC (rev 108033)
+++ Zope/branches/2.9/lib/python/OFS/tests/testSimpleItem.py 2010-01-11 21:47:29 UTC (rev 108034)
@@ -3,16 +3,62 @@
class TestItem(unittest.TestCase):
- def test_z3interfaces(self):
+ def _getTargetClass(self):
+ from OFS.SimpleItem import Item
+ return Item
+
+ def _makeOne(self, *args, **kw):
+ return self._getTargetClass()(*args, **kw)
+
+ def test_conforms_to_IItem(self):
from OFS.interfaces import IItem
+ from zope.interface.verify import verifyClass
+
+ verifyClass(IItem, self._getTargetClass())
+
+ def test_conforms_to_IManageable(self):
from OFS.interfaces import IManageable
- from OFS.SimpleItem import Item
from zope.interface.verify import verifyClass
- verifyClass(IItem, Item)
- verifyClass(IManageable, Item)
+ verifyClass(IManageable, self._getTargetClass())
+ def test_raise_StandardErrorMessage_str_errorValue(self):
+ item = self._makeOne()
+ def _raise_during_standard_error_message(*args, **kw):
+ raise ZeroDivisionError('testing')
+ item.standard_error_message = _raise_during_standard_error_message
+ try:
+ item.raise_standardErrorMessage(
+ error_type=OverflowError,
+ error_value='simple',
+ REQUEST={'dummy': ''},
+ )
+ except:
+ import sys
+ self.assertEqual(sys.exc_info()[0], 'OverflowError')
+ value = sys.exc_info()[1]
+ self.failUnless(value.startswith("'simple'"))
+ self.failUnless('full details: testing' in value)
+ def test_raise_StandardErrorMessage_TaintedString_errorValue(self):
+ from ZPublisher.TaintedString import TaintedString
+ item = self._makeOne()
+ def _raise_during_standard_error_message(*args, **kw):
+ raise ZeroDivisionError('testing')
+ item.standard_error_message = _raise_during_standard_error_message
+ try:
+ item.raise_standardErrorMessage(
+ error_type=OverflowError,
+ error_value=TaintedString('<simple>'),
+ REQUEST={'dummy': ''},
+ )
+ except:
+ import sys
+ self.assertEqual(sys.exc_info()[0], 'OverflowError')
+ value = sys.exc_info()[1]
+ self.failIf('<' in value)
+
+
class TestItem_w__name__(unittest.TestCase):
def test_z3interfaces(self):
Deleted: Zope/branches/2.9/lib/python/OFS/tests/test_SimpleItem.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/tests/test_SimpleItem.py 2010-01-11 21:36:17 UTC (rev 108033)
+++ Zope/branches/2.9/lib/python/OFS/tests/test_SimpleItem.py 2010-01-11 21:47:29 UTC (rev 108034)
@@ -1,51 +0,0 @@
-import unittest
-
-class ItemTests(unittest.TestCase):
-
- def _getTargetClass(self):
- from OFS.SimpleItem import Item
- return Item
-
- def _makeOne(self, *args, **kw):
- return self._getTargetClass()(*args, **kw)
-
- def test_raise_StandardErrorMessage_str_errorValue(self):
- item = self._makeOne()
- def _raise_during_standard_error_message(*args, **kw):
- raise ZeroDivisionError('testing')
- item.standard_error_message = _raise_during_standard_error_message
- try:
- item.raise_standardErrorMessage(
- error_type=OverflowError,
- error_value='simple',
- REQUEST={'dummy': ''},
- )
- except:
- import sys
- self.assertEqual(sys.exc_info()[0], 'OverflowError')
- value = sys.exc_info()[1]
- self.failUnless(value.startswith("'simple'"))
- self.failUnless('full details: testing' in value)
-
- def test_raise_StandardErrorMessage_TaintedString_errorValue(self):
- from ZPublisher.TaintedString import TaintedString
- item = self._makeOne()
- def _raise_during_standard_error_message(*args, **kw):
- raise ZeroDivisionError('testing')
- item.standard_error_message = _raise_during_standard_error_message
- try:
- item.raise_standardErrorMessage(
- error_type=OverflowError,
- error_value=TaintedString('<simple>'),
- REQUEST={'dummy': ''},
- )
- except:
- import sys
- self.assertEqual(sys.exc_info()[0], 'OverflowError')
- value = sys.exc_info()[1]
- self.failIf('<' in value)
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(ItemTests),
- ))
More information about the Zope-Checkins
mailing list