Beispiel #1
0
 def testPlainTerm(self):
     """
     Test that a regular boring search query with nothing special is parsed
     as such.
     """
     self.assertEquals(search.parseSearchTerm(u"foo"), (u"foo", None))
     self.assertEquals(search.parseSearchTerm(u"foo bar"), (u"foo bar", None))
Beispiel #2
0
 def testKeywordTerm(self):
     """
     Test keywords in a search query are found and returned.
     """
     self.assertEquals(search.parseSearchTerm(u"foo:bar"), (u"", {
         u"foo": u"bar"
     }))
     self.assertEquals(search.parseSearchTerm(u"foo bar:baz"),
                       (u"foo", {
                           u"bar": u"baz"
                       }))
     self.assertEquals(search.parseSearchTerm(u"foo bar baz:quux"),
                       (u"foo bar", {
                           u"baz": u"quux"
                       }))
     self.assertEquals(search.parseSearchTerm(u"foo bar:baz quux"),
                       (u"foo quux", {
                           u"bar": u"baz"
                       }))
     self.assertEquals(
         search.parseSearchTerm(u"foo bar:baz quux foobar:barbaz"),
         (u"foo quux", {
             u"bar": u"baz",
             u"foobar": u"barbaz"
         }))
Beispiel #3
0
 def testPlainTerm(self):
     """
     Test that a regular boring search query with nothing special is parsed
     as such.
     """
     self.assertEquals(search.parseSearchTerm(u"foo"), (u"foo", None))
     self.assertEquals(search.parseSearchTerm(u"foo bar"),
                       (u"foo bar", None))
Beispiel #4
0
    def testBadlyFormedKeywordTerm(self):
        """
        Test that a keyword search that isn't quite right gets cleaned up.
        """
        self.assertEquals(search.parseSearchTerm(u"foo:"), (u"foo", None))

        self.assertEquals(search.parseSearchTerm(u":foo"), (u"foo", None))

        self.assertEquals(search.parseSearchTerm(u":"), (u"", None))
Beispiel #5
0
    def testBadlyFormedKeywordTerm(self):
        """
        Test that a keyword search that isn't quite right gets cleaned up.
        """
        self.assertEquals(
            search.parseSearchTerm(u"foo:"),
            (u"foo", None))

        self.assertEquals(
            search.parseSearchTerm(u":foo"),
            (u"foo", None))

        self.assertEquals(
            search.parseSearchTerm(u":"),
            (u"", None))
Beispiel #6
0
 def testKeywordTerm(self):
     """
     Test keywords in a search query are found and returned.
     """
     self.assertEquals(
         search.parseSearchTerm(u"foo:bar"),
         (u"", {u"foo": u"bar"}))
     self.assertEquals(
         search.parseSearchTerm(u"foo bar:baz"),
         (u"foo", {u"bar": u"baz"}))
     self.assertEquals(
         search.parseSearchTerm(u"foo bar baz:quux"),
         (u"foo bar", {u"baz": u"quux"}))
     self.assertEquals(
         search.parseSearchTerm(u"foo bar:baz quux"),
         (u"foo quux", {u"bar": u"baz"}))
     self.assertEquals(
         search.parseSearchTerm(u"foo bar:baz quux foobar:barbaz"),
         (u"foo quux", {u"bar": u"baz", u"foobar": u"barbaz"}))