~seif/software-center/zeitgeist-popular-mimetypes

« back to all changes in this revision

Viewing changes to test/test_xapian.py

  • Committer: Michael Vogt
  • Date: 2010-10-07 15:45:31 UTC
  • Revision ID: michael.vogt@ubuntu.com-20101007154531-qzbzyy88irhrz6mi
add test for mime type query

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        matches = self.enquire.get_mset(0, 100)
43
43
        self.assertTrue(len(matches) > 5)
44
44
 
 
45
    def test_mime_query(self):
 
46
        query = xapian.Query("AMtext/html")
 
47
        self.enquire.set_query(query)
 
48
        matches = self.enquire.get_mset(0, 100)
 
49
        self.assertTrue(len(matches) > 5)
 
50
        pkgs = set()
 
51
        for match in matches:
 
52
            doc = match.get_document()
 
53
            pkgs.add(doc.get_value(XAPIAN_VALUE_PKGNAME))
 
54
        self.assertTrue("firefox" in pkgs)
 
55
 
45
56
if __name__ == "__main__":
46
57
    import logging
47
58
    logging.basicConfig(level=logging.DEBUG)