[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_fields.py Moar coverage for z.c.fields.Path.

Tres Seaver cvs-admin at zope.org
Wed May 9 20:24:15 UTC 2012


Log message for revision 125789:
  Moar coverage for z.c.fields.Path.

Changed:
  U   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_fields.py

-=-
Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_fields.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_fields.py	2012-05-09 20:24:08 UTC (rev 125788)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_fields.py	2012-05-09 20:24:12 UTC (rev 125789)
@@ -180,7 +180,7 @@
                           tok.fromUnicode, u(' 1 -1 3 '))
 
 
-class PathTests(unittest.TestCase):
+class PathTests(unittest.TestCase, _ConformsToIFromUnicode):
 
     def _getTargetClass(self):
         from zope.configuration.fields import Path
@@ -189,7 +189,22 @@
     def _makeOne(self, *args, **kw):
         return self._getTargetClass()(*args, **kw)
 
+    def test_fromUnicode_absolute(self):
+        path = self._makeOne()
+        self.assertEqual(path.fromUnicode('/'), '/')
 
+    def test_fromUnicode_relative(self):
+        class Context(object):
+            def path(self, value):
+                self._pathed = value
+                return '/hard/coded'
+        context = Context()
+        path = self._makeOne()
+        bound = path.bind(context)
+        self.assertEqual(bound.fromUnicode('relative/path'), '/hard/coded')
+        self.assertEqual(context._pathed, 'relative/path')
+
+
 class BoolTests(unittest.TestCase):
 
     def _getTargetClass(self):



More information about the checkins mailing list