[CalendarServer-changes] [12513] twext/trunk/twext/who/test/test_expression.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:23:14 PDT 2014
Revision: 12513
http://trac.calendarserver.org//changeset/12513
Author: wsanchez at apple.com
Date: 2014-01-31 13:27:07 -0800 (Fri, 31 Jan 2014)
Log Message:
-----------
Test MatchFlags static methods.
Modified Paths:
--------------
twext/trunk/twext/who/test/test_expression.py
Modified: twext/trunk/twext/who/test/test_expression.py
===================================================================
--- twext/trunk/twext/who/test/test_expression.py 2014-01-31 21:26:45 UTC (rev 12512)
+++ twext/trunk/twext/who/test/test_expression.py 2014-01-31 21:27:07 UTC (rev 12513)
@@ -25,7 +25,56 @@
+class MatchFlagsTest(unittest.TestCase):
+ """
+ Tests for L{MatchFlags}.
+ """
+
+ def test_predicator_none(self):
+ """
+ Predicator for flags without L{MatchFlags.NOT} does not invert.
+ """
+ predicator = MatchFlags.predicator(MatchFlags.none)
+
+ for boolean in (True, False):
+ self.assertEquals(bool(predicator(boolean)), boolean)
+
+
+ def test_predicator_NOT(self):
+ """
+ Predicator for flags with L{MatchFlags.NOT} does not invert.
+ """
+ predicator = MatchFlags.predicator(MatchFlags.NOT)
+
+ for boolean in (True, False):
+ self.assertNotEquals(bool(predicator(boolean)), boolean)
+
+
+ def test_normalizer_none(self):
+ """
+ Normalizer for flags without L{MatchFlags.caseInsensitive} does not
+ lowercase.
+ """
+ normalizer = MatchFlags.normalizer(MatchFlags.none)
+
+ self.assertEquals(normalizer(u"ThInGo"), u"ThInGo")
+
+
+ def test_normalizer_insensitive(self):
+ """
+ Normalizer for flags with L{MatchFlags.caseInsensitive} lowercases.
+ """
+ normalizer = MatchFlags.normalizer(MatchFlags.caseInsensitive)
+
+ self.assertEquals(normalizer(u"ThInGo"), u"thingo")
+
+
+
class MatchExpressionTest(unittest.TestCase):
+ """
+ Tests for L{MatchExpression}.
+ """
+
def test_repr_name(self):
self.assertEquals(
"<MatchExpression: u'full names' equals u'Wilfredo Sanchez'>",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/0efdc40e/attachment.html>
More information about the calendarserver-changes
mailing list