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