def extract_authors_test(): authors, title = Preprocessor.extract_authors(u"Старый Хелом") assert not authors authors, title = Preprocessor.extract_authors(u"О Шекспире") assert not authors authors, title = Preprocessor.extract_authors(u"Кристофер Сташефф, Уильям Р.Форстчен. Расплата") #print authors,title pass
def cleanup_kilobytes_test(): assert u"Book yeah!" == Preprocessor.cleanup_kilobytes(u"Book (19 k) yeah!") pass
def cleanup_numeration_test(): titles = ['1. Василий Теркин', '2. Теркин на том свете', '62. Модель для сборки', '35.Проклятие вождя','Причесывая Жирафу.. Глава 1.'] r_titles = ['Василий Теркин', 'Теркин на том свете', 'Модель для сборки', 'Проклятие вождя','Причесывая Жирафу.. Глава 1.'] for title, r_title in zip(titles, r_titles): title = Preprocessor.cleanup_numeration(title) assert title == r_title
def is_author_test(): assert Preprocessor.is_author(u"Старый Хелом") == True pass
def cleanup_year_test(): assert u"Book yeah!" == Preprocessor.cleanup_year(u"Book (1990) yeah!") assert u"Book yeah!" == Preprocessor.cleanup_year(u"Book [1990] yeah!")