Exemple #1
0
    def testGetLangSingle_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        self._createDict(self.tempDirList[0], "ru_RU")

        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), ["ru_RU"])
Exemple #2
0
    def testGetLangSingle_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        self._createDict(self.tempDirList[0], "ru_RU")

        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), ["ru_RU"])
Exemple #3
0
    def testGetLangSingle_invalid_02(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))

        with open(os.path.join(self.tempDirList[0],
                               "ru_RU" + DictsFinder.dictExtensions[1]), "w"):
            pass

        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), [])
Exemple #4
0
    def testGetLangSeveral_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        self._createDict(self.tempDirList[0], "ru_RU")
        self._createDict(self.tempDirList[0], "en_US")

        finder = DictsFinder(self.tempDirList)

        langs = finder.getLangList()
        langs.sort()

        self.assertEqual(langs, ["en_US", "ru_RU"])
Exemple #5
0
    def testGetLangSingle_invalid_02(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))

        with open(
                os.path.join(self.tempDirList[0],
                             "ru_RU" + DictsFinder.dictExtensions[1]), "w"):
            pass

        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), [])
Exemple #6
0
    def testGetLangSeveral_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        self._createDict(self.tempDirList[0], "ru_RU")
        self._createDict(self.tempDirList[0], "en_US")

        finder = DictsFinder(self.tempDirList)

        langs = finder.getLangList()
        langs.sort()

        self.assertEqual(langs, ["en_US", "ru_RU"])
    def testRuEn_01(self):
        self._copyDict('ru_RU')
        self._copyDict('en_US')
        checker = SpellChecker(['ru_RU', 'en_US'], [self._pathToDicts])
        self.assertTrue(checker.check('Проверка'))
        self.assertTrue(checker.check('cat'))
        self.assertFalse(checker.check('ывпывапыяа'))
        self.assertFalse(checker.check('adfasdfasd'))

        finder = DictsFinder([self._pathToDicts])
        langs = sorted(finder.getLangList())

        self.assertEqual(langs, ["en_US", "ru_RU"])
Exemple #8
0
    def testGetLangSingleEmpty(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), [])
Exemple #9
0
 def testGetLangEmpty(self):
     finder = DictsFinder(self.tempDirList)
     self.assertEqual(finder.getLangList(), [])
Exemple #10
0
    def testGetLangSingleEmpty(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        finder = DictsFinder(self.tempDirList)

        self.assertEqual(finder.getLangList(), [])
Exemple #11
0
 def testGetLangEmpty(self):
     finder = DictsFinder(self.tempDirList)
     self.assertEqual(finder.getLangList(), [])