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]])
def testGetLangSingle_01 (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell')) self._createDict (self.tempDirList[0], u"ru_RU") finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getLangList(), [u"ru_RU"])
def testGetFolders_02 (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell 1')) self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell 2')) self._createDict (self.tempDirList[0], u"ru_RU") finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getFoldersForLang (u"ru_RU"), [self.tempDirList[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"])
def testGetFolders_empty_03_invalid (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell 1')) with open (os.path.join (self.tempDirList[0], u"ru_RU" + DictsFinder.dictExtensions[0]), "w"): pass finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getFoldersForLang (u"ru_RU"), [])
def testGetLangSingle_invalid_02 (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell')) with open (os.path.join (self.tempDirList[0], "ru_RU" + DictsFinder.dictExtensions[1]), "w"): pass finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getLangList(), [])
def testGetFolders_04 (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell 1')) self._createDict (self.tempDirList[0], u"ru_RU") self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell 2')) self._createDict (self.tempDirList[1], u"ru_RU") self._createDict (self.tempDirList[1], u"en_US") finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getFoldersForLang (u"ru_RU"), [self.tempDirList[0], self.tempDirList[1]]) self.assertEqual (finder.getFoldersForLang (u"en_US"), [self.tempDirList[1]])
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 testGetLangSeveral_01 (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell')) self._createDict (self.tempDirList[0], u"ru_RU") self._createDict (self.tempDirList[0], u"en_US") finder = DictsFinder (self.tempDirList) langs = finder.getLangList() langs.sort() self.assertEqual (langs, [u"en_US", u"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"])
def testRuEn_01 (self): self._copyDict (u'ru_RU') self._copyDict (u'en_US') checker = SpellChecker (self._application, [u'ru_RU', u'en_US'], [self._pathToDicts]) self.assertTrue (checker.check (u'Проверка')) self.assertTrue (checker.check (u'cat')) self.assertFalse (checker.check (u'ывпывапыяа')) self.assertFalse (checker.check (u'adfasdfasd')) finder = DictsFinder ([self._pathToDicts]) langs = finder.getLangList() langs.sort() self.assertEqual (langs, [u"en_US", u"ru_RU"])
def testRuEn_01(self): self._copyDict(u'ru_RU') self._copyDict(u'en_US') checker = SpellChecker(self._application, [u'ru_RU', u'en_US'], [self._pathToDicts]) self.assertTrue(checker.check(u'Проверка')) self.assertTrue(checker.check(u'cat')) self.assertFalse(checker.check(u'ывпывапыяа')) self.assertFalse(checker.check(u'adfasdfasd')) finder = DictsFinder([self._pathToDicts]) langs = finder.getLangList() langs.sort() self.assertEqual(langs, [u"en_US", u"ru_RU"])
def testGetLangEmpty (self): finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getLangList(), [])
def testGetFolders_empty_01 (self): finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getFoldersForLang (u"ru_RU"), [])
def testGetLangSingleEmpty(self): self.tempDirList.append(mkdtemp(prefix='Абырвалг spell')) finder = DictsFinder(self.tempDirList) self.assertEqual(finder.getLangList(), [])
def testGetLangEmpty(self): finder = DictsFinder(self.tempDirList) self.assertEqual(finder.getLangList(), [])
def testGetLangSingleEmpty (self): self.tempDirList.append (mkdtemp (prefix=u'Абырвалг spell')) finder = DictsFinder (self.tempDirList) self.assertEqual (finder.getLangList(), [])
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"), [])
def testGetFolders_empty_01(self): finder = DictsFinder(self.tempDirList) self.assertEqual(finder.getFoldersForLang("ru_RU"), [])