예제 #1
0
 def testInstance(self, mocker):
     mockClean = mocker.patch.object(ClassifyManager, 'cleanStr')
     mockClean.side_effect = [
         'testTitle', 'testAuthor', 'testTitle', 'testAuthor'
     ]
     return ClassifyManager(iden=1,
                            idenType='test',
                            title='testTitle',
                            author='testAuthor')
예제 #2
0
 def test_cleanStr(self):
     assert ClassifyManager.cleanStr('hello\n line\r') == 'hello line'
예제 #3
0
 def test_cleanIdentifier(self):
     assert ClassifyManager.cleanIdentifier('no1234') == '1234'
예제 #4
0
 def test_getQueryableIdentifiers(self):
     assert ClassifyManager.getQueryableIdentifiers(['1|isbn', '2|test'
                                                     ]) == ['1|isbn']
예제 #5
0
 def test_cleanTitle(self):
     assert ClassifyManager.cleanTitle('The Real Title()') == [
         'real', 'title'
     ]
예제 #6
0
 def test_getStrLang_not_a_string_error(self):
     assert ClassifyManager.getStrLang(34) == 'unk'
예제 #7
0
 def test_getStrLang_error(self):
     assert ClassifyManager.getStrLang('01234') == 'unk'
예제 #8
0
 def test_getStrLang_nonLatin(self):
     assert ClassifyManager.getStrLang('わかりません') == 'ja'
예제 #9
0
 def test_getStrLang_success(self):
     assert ClassifyManager.getStrLang('English') == 'en'