def test_update_from_var_lib_apt_lists(self): # ensure we index with german locales to test i18n os.environ["LANGUAGE"] = "de" db = xapian.inmemory_open() res = update_from_var_lib_apt_lists(db, self.cache, listsdir=os.path.join( DATA_DIR, "app-info")) self.assertTrue(res) self.assertEqual(db.get_doccount(), 1) # test if Name-de was picked up i = 0 for it in db.postlist("AAFestplattenbelegung analysieren"): i += 1 self.assertEqual(i, 1) # test if gettext worked found_gettext_translation = False for it in db.postlist("AAFestplattenbelegung analysieren"): doc = db.get_document(it.docid) for term_iter in doc.termlist(): # a german term from the app-info file to ensure that # it got indexed in german if term_iter.term == "festplattenbelegung": found_gettext_translation = True break self.assertTrue(found_gettext_translation)
def test_update_from_var_lib_apt_lists(self): # ensure we index with german locales to test i18n os.environ["LANGUAGE"] = "de" db = xapian.WritableDatabase("./data/test.db", xapian.DB_CREATE_OR_OVERWRITE) res = update_from_var_lib_apt_lists(db, self.cache, listsdir="./data/app-info/") self.assertTrue(res) self.assertEqual(db.get_doccount(), 1) # test if Name-de was picked up i = 0 for it in db.postlist("AAFestplatten Ueberpruefer"): i += 1 self.assertEqual(i, 1) # test if gettext worked found_gettext_translation = False for it in db.postlist("AAFestplatten Ueberpruefer"): doc = db.get_document(it.docid) for term_iter in doc.termlist(): # a german term from the app-info file to ensure that # it got indexed in german if term_iter.term == "platzes": found_gettext_translation = True break self.assertTrue(found_gettext_translation)
def test_update_from_var_lib_apt_lists(self): # ensure we index with german locales to test i18n os.environ["LANGUAGE"] = "de" db = xapian.inmemory_open() res = update_from_var_lib_apt_lists(db, self.cache, listsdir=os.path.join(DATA_DIR, "app-info")) self.assertTrue(res) self.assertEqual(db.get_doccount(), 1) # test if Name-de was picked up i = 0 for it in db.postlist("AAFestplattenbelegung analysieren"): i += 1 self.assertEqual(i, 1) # test if gettext worked found_gettext_translation = False for it in db.postlist("AAFestplattenbelegung analysieren"): doc = db.get_document(it.docid) for term_iter in doc.termlist(): # a german term from the app-info file to ensure that # it got indexed in german if term_iter.term == "festplattenbelegung": found_gettext_translation = True break self.assertTrue(found_gettext_translation)