示例#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"])
示例#2
0
    def testGetFolders_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))
        self._createDict(self.tempDirList[0], "ru_RU")

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"),
                         [self.tempDirList[0]])
示例#3
0
    def testGetFolders_01(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))
        self._createDict(self.tempDirList[0], "ru_RU")

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"),
                         [self.tempDirList[0]])
示例#4
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"])
示例#5
0
    def _fillDictsList(self):
        dicts = DictsFinder(getSpellDirList()).getLangList()
        dicts.sort()
        selectedDicts = filter(lambda item: item in dicts,
                               self._getDictsFromConfig())

        self.dictsList.Clear()
        self.dictsList.AppendItems(dicts)
        self.dictsList.SetCheckedStrings(selectedDicts)
示例#6
0
    def testGetFolders_empty_03_invalid(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))

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

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"), [])
示例#7
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(), [])
示例#8
0
    def testGetFolders_empty_03_invalid(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))

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

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"), [])
示例#9
0
    def _fillDictsList(self):
        dicts = DictsFinder(getSpellDirList()).getLangList()
        dicts.sort()
        selectedDicts = [item
                         for item in self._getDictsFromConfig()
                         if item in dicts]

        self.dictsList.Clear()
        self.dictsList.AppendItems(dicts)
        self.dictsList.SetCheckedStrings(selectedDicts)
示例#10
0
    def _fillDictsList(self):
        dicts = DictsFinder(getSpellDirList()).getLangList()
        dicts.sort()
        selectedDicts = [
            item for item in self._getDictsFromConfig() if item in dicts
        ]

        self.dictsList.Clear()
        self.dictsList.AppendItems(dicts)
        self.dictsList.SetCheckedStrings(selectedDicts)
示例#11
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"])
示例#12
0
    def _fillDictsList (self):
        dicts = DictsFinder (getSpellDirList()).getLangList()
        dicts.sort()
        selectedDicts = filter (
            lambda item: item in dicts,
            self._getDictsFromConfig())


        self.dictsList.Clear()
        self.dictsList.AppendItems (dicts)
        self.dictsList.SetCheckedStrings (selectedDicts)
示例#13
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"])
示例#14
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(), [])
示例#15
0
    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"])
示例#16
0
    def testGetFolders_empty_02(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 2'))

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"), [])
示例#17
0
 def testGetLangEmpty(self):
     finder = DictsFinder(self.tempDirList)
     self.assertEqual(finder.getLangList(), [])
示例#18
0
    def testGetLangSingleEmpty(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell'))
        finder = DictsFinder(self.tempDirList)

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

        self.assertEqual(finder.getLangList(), [])
示例#21
0
    def testGetFolders_empty_02(self):
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 1'))
        self.tempDirList.append(mkdtemp(prefix='Абырвалг spell 2'))

        finder = DictsFinder(self.tempDirList)
        self.assertEqual(finder.getFoldersForLang("ru_RU"), [])
示例#22
0
 def testGetFolders_empty_01(self):
     finder = DictsFinder(self.tempDirList)
     self.assertEqual(finder.getFoldersForLang("ru_RU"), [])
示例#23
0
 def testGetFolders_empty_01(self):
     finder = DictsFinder(self.tempDirList)
     self.assertEqual(finder.getFoldersForLang("ru_RU"), [])