[Zope-CVS] CVS: Products/ZCTextIndex/tests - testQueryParser.py:1.1.2.4
Tim Peters
tim.one@comcast.net
Thu, 2 May 2002 18:43:47 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv8517/tests
Modified Files:
Tag: TextIndexDS9-branch
testQueryParser.py
Log Message:
Made keyword recognition case-insensitive ("AND", "and", "aNd", ..., all
the same thing).
=== Products/ZCTextIndex/tests/testQueryParser.py 1.1.2.3 => 1.1.2.4 ===
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
-#
+#
##############################################################################
from unittest import TestCase, TestSuite, main, makeSuite
@@ -49,32 +49,33 @@
def testParseQuery(self):
self.expect("foo", AtomNode("foo"))
- self.expect("not", AtomNode("not"))
- self.expect("a AND b AND c",
+ self.expect("note", AtomNode("note"))
+ self.expect("a and b AND c",
AndNode([AtomNode("a"), AtomNode("b"), AtomNode("c")]))
- self.expect("a OR b OR c",
+ self.expect("a OR b or c",
OrNode([AtomNode("a"), AtomNode("b"), AtomNode("c")]))
- self.expect("a AND b OR c AND d",
+ self.expect("a AND b OR c AnD d",
OrNode([AndNode([AtomNode("a"), AtomNode("b")]),
AndNode([AtomNode("c"), AtomNode("d")])]))
self.expect("(a OR b) AND (c OR d)",
AndNode([OrNode([AtomNode("a"), AtomNode("b")]),
OrNode([AtomNode("c"), AtomNode("d")])]))
- self.expect("a AND NOT b",
+ self.expect("a AND not b",
AndNode([AtomNode("a"), NotNode(AtomNode("b"))]))
def testParseFailures(self):
self.failure("")
+ self.failure("not")
self.failure("OR")
self.failure("AND")
- self.failure("NOT foo")
+ self.failure("not foo")
self.failure(")")
self.failure("(")
self.failure("foo bar")
self.failure("foo OR")
self.failure("foo AND")
self.failure("OR foo")
- self.failure("AND foo")
+ self.failure("and foo")
self.failure("(foo bar)")
self.failure("(foo OR)")
self.failure("(foo AND)")