[CalendarServer-changes] [10799] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 21 20:30:06 PST 2013
Revision: 10799
http://trac.calendarserver.org//changeset/10799
Author: wsanchez at apple.com
Date: 2013-02-21 20:30:06 -0800 (Thu, 21 Feb 2013)
Log Message:
-----------
Text expression
Modified Paths:
--------------
CalendarServer/trunk/twext/who/expression.py
Added Paths:
-----------
CalendarServer/trunk/twext/who/test/test_expression.py
Modified: CalendarServer/trunk/twext/who/expression.py
===================================================================
--- CalendarServer/trunk/twext/who/expression.py 2013-02-22 04:29:26 UTC (rev 10798)
+++ CalendarServer/trunk/twext/who/expression.py 2013-02-22 04:30:06 UTC (rev 10799)
@@ -85,7 +85,7 @@
if self.flags is None:
flags = ""
else:
- flags = " (%s)" % (self.flags,)
+ flags = " (%s)" % (describe(self.flags),)
return "<%s: %r %s %r%s>" % (
self.__class__.__name__,
Added: CalendarServer/trunk/twext/who/test/test_expression.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_expression.py (rev 0)
+++ CalendarServer/trunk/twext/who/test/test_expression.py 2013-02-22 04:30:06 UTC (rev 10799)
@@ -0,0 +1,55 @@
+##
+# Copyright (c) 2013 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Directory service expression tests.
+"""
+
+from twisted.trial import unittest
+
+from twext.who.idirectory import FieldName
+from twext.who.expression import MatchExpression, MatchType, MatchFlags
+
+
+
+class MatchExpressionTest(unittest.TestCase):
+ def test_repr(self):
+ self.assertEquals(
+ "<MatchExpression: 'full names' equals 'Wilfredo Sanchez'>",
+ repr(MatchExpression(
+ FieldName.fullNames,
+ "Wilfredo Sanchez",
+ )),
+ )
+
+ self.assertEquals(
+ "<MatchExpression: 'full names' contains 'Sanchez'>",
+ repr(MatchExpression(
+ FieldName.fullNames,
+ "Sanchez",
+ matchType=MatchType.contains,
+ )),
+ )
+
+ self.assertEquals(
+ "<MatchExpression: 'full names' starts with 'Wilfredo' (not)>",
+ repr(MatchExpression(
+ FieldName.fullNames,
+ "Wilfredo",
+ matchType=MatchType.startsWith,
+ flags=MatchFlags.NOT,
+ )),
+ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130221/3c9f39fc/attachment.html>
More information about the calendarserver-changes
mailing list