def setUp(self): info = MorphologyInfo() info.variant = VARIANT_NAME info.morphology = u"null" info.speller = u"AllOk" info.suggestion = u"null" self.dataDir = TestDataDir() self.dataDir.createMorphology(VARIANT_NAME, info) self.voikko = libvoikko.Voikko("fi-x-" + VARIANT_NAME, path = self.dataDir.getDirectory())
def testListDictsWithPathAndAttributes(self): info = MorphologyInfo() info.variant = u"test-variant-name" info.description = u"Some test description sakldjasd" info.morphology = u"null" dataDir = TestDataDir() dataDir.createMorphology(info.variant, info) dicts = Voikko.listDicts(dataDir.getDirectory()) dataDir.tearDown() dictsWithCorrectVariant = filter(lambda aDict: aDict.variant == info.variant, dicts) self.assertEqual(1, len(dictsWithCorrectVariant)) theDict = dictsWithCorrectVariant[0] self.assertEqual(info.description, theDict.description) self.assertEqual(u"fi", theDict.language)
def testOtherLanguagesCanBeUsed(self): info2 = MorphologyInfo() info2.language = u"dk" info2.morphology = u"null" info2.description = "Testdescription lkrj" self.dataDir.createMorphology(u"test1", info2) self.assertTrue(self.__tryOpenWithNewApi(u"dk")) languages = libvoikko.Voikko.listSupportedSpellingLanguages(self.dataDir.getDirectory()) self.assertTrue(u"fi" in languages) self.assertTrue(u"dk" in languages) dicts = libvoikko.Voikko.listDicts(self.dataDir.getDirectory()) for dictionary in dicts: if dictionary.language == u"dk": self.assertEquals(info2.description, dictionary.description) return self.fail(u"Should have found dk dictionary")
def testOtherLanguagesCanBeUsed(self): info2 = MorphologyInfo() info2.language = u"dk" info2.morphology = u"null" info2.description = "Testdescription lkrj" self.dataDir.createMorphology(u"test1", info2) self.assertTrue(self.__tryOpenWithNewApi(u"dk")) languages = libvoikko.Voikko.listSupportedSpellingLanguages( self.dataDir.getDirectory()) self.assertTrue(u"fi" in languages) self.assertTrue(u"dk" in languages) dicts = libvoikko.Voikko.listDicts(self.dataDir.getDirectory()) for dictionary in dicts: if dictionary.language == u"dk": self.assertEquals(info2.description, dictionary.description) self.assertEquals(u"standard", dictionary.variant) return self.fail(u"Should have found dk dictionary")
def setUp(self): info = MorphologyInfo() info.variant = VARIANT_NAME info.morphology = u"null" info.speller = u"AllOk" info.suggestion = u"null" self.dataDir = TestDataDir() self.dataDir.createMorphology(VARIANT_NAME, info) self.voikko = libvoikko.Voikko("fi-x-" + VARIANT_NAME, path=self.dataDir.getDirectory())
def setUp(self): info = MorphologyInfo() info.variant = VARIANT_NAME info.morphology = u"null" self.dataDir = TestDataDir() self.dataDir.createMorphology(VARIANT_NAME, info)