[Checkins] SVN: zope.schema/branches/tseaver-test_cleanup/src/zope/schema/tests/test__bootstrapinterfaces.py Coverage for z.s._bi.ValidationError.

Tres Seaver cvs-admin at zope.org
Mon Apr 23 21:59:12 UTC 2012


Log message for revision 125252:
  Coverage for z.s._bi.ValidationError.

Changed:
  A   zope.schema/branches/tseaver-test_cleanup/src/zope/schema/tests/test__bootstrapinterfaces.py

-=-
Added: zope.schema/branches/tseaver-test_cleanup/src/zope/schema/tests/test__bootstrapinterfaces.py
===================================================================
--- zope.schema/branches/tseaver-test_cleanup/src/zope/schema/tests/test__bootstrapinterfaces.py	                        (rev 0)
+++ zope.schema/branches/tseaver-test_cleanup/src/zope/schema/tests/test__bootstrapinterfaces.py	2012-04-23 21:59:09 UTC (rev 125252)
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# Copyright (c) 2012 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import unittest
+
+
+class ValidationErrorTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from zope.schema._bootstrapinterfaces import ValidationError
+        return ValidationError
+
+    def _makeOne(self, *args, **kw):
+        return self._getTargetClass()(*args, **kw)
+
+    def test_doc(self):
+        class Derived(self._getTargetClass()):
+            """DERIVED"""
+        inst = Derived()
+        self.assertEqual(inst.doc(), 'DERIVED')
+
+    def test___cmp___no_args(self):
+        # Py3k??
+        ve = self._makeOne()
+        self.assertEqual(cmp(ve, object()), -1)
+
+    def test___cmp___hit(self):
+        # Py3k??
+        left = self._makeOne('abc')
+        right = self._makeOne('def')
+        self.assertEqual(cmp(left, right), -1)
+        self.assertEqual(cmp(left, left), 0)
+        self.assertEqual(cmp(right, left), 1)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(ValidationErrorTests),
+    ))



More information about the checkins mailing list