Beispiel #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')
Beispiel #2
0
 def test_cleanStr(self):
     assert ClassifyManager.cleanStr('hello\n line\r') == 'hello line'
Beispiel #3
0
 def test_cleanIdentifier(self):
     assert ClassifyManager.cleanIdentifier('no1234') == '1234'
Beispiel #4
0
 def test_getQueryableIdentifiers(self):
     assert ClassifyManager.getQueryableIdentifiers(['1|isbn', '2|test'
                                                     ]) == ['1|isbn']
Beispiel #5
0
 def test_cleanTitle(self):
     assert ClassifyManager.cleanTitle('The Real Title()') == [
         'real', 'title'
     ]
Beispiel #6
0
 def test_getStrLang_not_a_string_error(self):
     assert ClassifyManager.getStrLang(34) == 'unk'
Beispiel #7
0
 def test_getStrLang_error(self):
     assert ClassifyManager.getStrLang('01234') == 'unk'
Beispiel #8
0
 def test_getStrLang_nonLatin(self):
     assert ClassifyManager.getStrLang('わかりません') == 'ja'
Beispiel #9
0
 def test_getStrLang_success(self):
     assert ClassifyManager.getStrLang('English') == 'en'