def localTest_parseYearFromString(self): self._assertEquals('2010', common.parseYearFromString('2010'), 'Wrong year.') self._assertEquals('2011', common.parseYearFromString(' - 2011'), 'Wrong year.') self._assertEquals('2012', common.parseYearFromString('2012 - ...'), 'Wrong year.') self._assertEquals('2013', common.parseYearFromString('... - 2013 - ...'), 'Wrong year.') self._assertEquals('2014', common.parseYearFromString('aa2014000'), 'Wrong year.') ######## TESTS END HERE ###################################################### def _assertTitleTuple(self, tuple, kinopoiskId, title, year, score): self._assertEquals(title, tuple[1].encode('utf8'), 'Wrong title') self._assertEquals(year, tuple[2], 'Wrong year') self._assertEquals(kinopoiskId, tuple[0], 'Wrong kinopoisk id') self._assertEquals(score, tuple[3], 'Wrong score') if __name__ == '__main__': # When changing this code, pls make sure to adjust main.py accordingly. (options, args) = U.parseTestOptions() testlog.logLevel = options.logLevel runner = unittest.TextTestRunner(verbosity=testlog.TEST_RUNNER_VERBOSITY) result = runner.run(suite(options.excludeRemote)) sys.exit(U.getExitCode(result))
score = common.scoreMediaTitleMatch('Gladiatory Rima', '2012', u'Гладиаторы Рима', 'Gladiatori di Roma', '2012', 3) self._assertEquals(92, score, 'Wrong score.') score = common.scoreMediaTitleMatch(u'Кавказская пленница', '1966', u'Кавказская пленница, или Новые приключения Шурика', None, '1966', 0) self._assertEquals(94, score, 'Wrong score.') def localTest_parseYearFromString(self): self._assertEquals('2010', common.parseYearFromString('2010'), 'Wrong year.') self._assertEquals('2011', common.parseYearFromString(' - 2011'), 'Wrong year.') self._assertEquals('2012', common.parseYearFromString('2012 - ...'), 'Wrong year.') self._assertEquals('2013', common.parseYearFromString('... - 2013 - ...'), 'Wrong year.') self._assertEquals('2014', common.parseYearFromString('aa2014000'), 'Wrong year.') ######## TESTS END HERE ###################################################### def _assertTitleTuple(self, tuple, kinopoiskId, title, year, score): self._assertEquals(title, tuple[1].encode('utf8'), 'Wrong title') self._assertEquals(year, tuple[2], 'Wrong year') self._assertEquals(kinopoiskId, tuple[0], 'Wrong kinopoisk id') self._assertEquals(score, tuple[3], 'Wrong score') if __name__ == '__main__': # When changing this code, pls make sure to adjust main.py accordingly. (options, args) = U.parseTestOptions() testlog.logLevel = options.logLevel runner = unittest.TextTestRunner(verbosity=testlog.TEST_RUNNER_VERBOSITY) result = runner.run(suite(options.excludeRemote)) sys.exit(U.getExitCode(result))