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))
# @author zhenya (Yevgeny Nyden) # import unittest, sys import testlog, testutil as U, titlepage_test, studiopage_test, \ pageparser_test, peoplepage_test, imagepages_test, misc_test if __name__ == '__main__': # When changing this code, pls make sure to adjust __main__ method # in individual test files accordingly (in case we'd want to run them separately). (options, args) = U.parseTestOptions() testlog.logLevel = options.logLevel runner = unittest.TextTestRunner(verbosity=testlog.TEST_RUNNER_VERBOSITY) result = runner.run(titlepage_test.suite(options.excludeRemote)) exitCode = U.getExitCode(result) result = runner.run(studiopage_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(pageparser_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(peoplepage_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(imagepages_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(misc_test.suite(options.excludeRemote)) exitCode |= 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))
# import unittest, sys import testlog, testutil as U, titlepage_test, studiopage_test, \ pageparser_test, peoplepage_test, imagepages_test, misc_test if __name__ == '__main__': # When changing this code, pls make sure to adjust __main__ method # in individual test files accordingly (in case we'd want to run them separately). (options, args) = U.parseTestOptions() testlog.logLevel = options.logLevel runner = unittest.TextTestRunner(verbosity=testlog.TEST_RUNNER_VERBOSITY) result = runner.run(titlepage_test.suite(options.excludeRemote)) exitCode = U.getExitCode(result) result = runner.run(studiopage_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(pageparser_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(peoplepage_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(imagepages_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result) result = runner.run(misc_test.suite(options.excludeRemote)) exitCode |= U.getExitCode(result)