コード例 #1
0
	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())
コード例 #2
0
ファイル: libvoikkoTest.py プロジェクト: komu/corevoikko
 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)
コード例 #3
0
	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)
コード例 #4
0
ファイル: DictionaryInfoTest.py プロジェクト: komu/corevoikko
	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")
コード例 #5
0
    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")
コード例 #6
0
 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())
コード例 #7
0
 def setUp(self):
     info = MorphologyInfo()
     info.variant = VARIANT_NAME
     info.morphology = u"null"
     self.dataDir = TestDataDir()
     self.dataDir.createMorphology(VARIANT_NAME, info)
コード例 #8
0
	def setUp(self):
		info = MorphologyInfo()
		info.variant = VARIANT_NAME
		info.morphology = u"null"
		self.dataDir = TestDataDir()
		self.dataDir.createMorphology(VARIANT_NAME, info)