class LeetcodeTest(unittest.TestCase): def setUp(self): self.judge = Judge() def testAllProblems(self): leetcodePath = "problems/leetcode/" allPyFiles = filter(lambda f: f.endswith(".py"), listdir(leetcodePath)) pCount = 0 for f in allPyFiles: problemModule = imp.load_source(f[:-3], join(leetcodePath, f)) # filename without .py problem = getattr(problemModule, "problem", None) if problem: self.assertTrue(self.judge.judge(problem())) pCount += 1 print "%i problems verified." % pCount
class LeetcodeTest(unittest.TestCase): def setUp(self): self.judge = Judge() def testAllProblems(self): leetcodePath = 'problems/leetcode/' allPyFiles = filter(lambda f: f.endswith('.py'), listdir(leetcodePath)) pCount = 0 for f in allPyFiles: problemModule = imp.load_source( f[:-3], # filename without .py join(leetcodePath, f)) problem = getattr(problemModule, 'problem', None) if problem: self.assertTrue(self.judge.judge(problem())) pCount += 1 print '%i problems verified.' % pCount