[CalendarServer-changes] [12587] twext/trunk/twext/who/test/test_util.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:20:16 PDT 2014


Revision: 12587
          http://trac.calendarserver.org//changeset/12587
Author:   wsanchez at apple.com
Date:     2014-02-06 06:22:47 -0800 (Thu, 06 Feb 2014)
Log Message:
-----------
More describe tests

Modified Paths:
--------------
    twext/trunk/twext/who/test/test_util.py

Modified: twext/trunk/twext/who/test/test_util.py
===================================================================
--- twext/trunk/twext/who/test/test_util.py	2014-02-06 14:10:28 UTC (rev 12586)
+++ twext/trunk/twext/who/test/test_util.py	2014-02-06 14:22:47 UTC (rev 12587)
@@ -269,16 +269,37 @@
     """
 
     def test_uniqueResult(self):
+        """
+        L{uniqueResult} returns the single value it is given, raises
+        L{DirectoryServiceError} is given more than one, or returns L{None}
+        if given on values.
+        """
+        self.assertEquals(None, uniqueResult(()))
         self.assertEquals(1, uniqueResult((1,)))
         self.assertRaises(DirectoryServiceError, uniqueResult, (1, 2, 3))
 
 
-    def test_describe(self):
+    def test_describeConstant(self):
+        """
+        L{describe} will look up the C{description} attribute on constants and
+        fall back to the C{name} attribute.
+        """
         self.assertEquals(u"nail pounder", describe(Tools.hammer))
         self.assertEquals(u"hammer", describe(Instruments.hammer))
 
 
     def test_describeFlags(self):
+        """
+        L{describe} on flags will describe the contained flags by joining their
+        descriptions with C{"|"}.
+        """
         self.assertEquals(u"blue", describe(Switches.b))
         self.assertEquals(u"red|green", describe(Switches.r | Switches.g))
         self.assertEquals(u"blue|black", describe(Switches.b | Switches.black))
+
+    def test_describeObject(self):
+        """
+        L{describe} will cast non-cosntant objects to L{unicode}.
+        """
+        for obj in (object(), u"string", b"data"):
+            self.assertEquals(describe(obj), unicode(obj))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/b981aee7/attachment.html>


More information about the calendarserver-changes mailing list