diff 2.00/problem.py @ 23:c1f52b5d80d6

Compatibility and bug fixes -1 command line option added (currently only detects the presence of test groups). The ansname configuration variable is now (again) optional when output validators are used. Bug fix: path realization only looked at paths beginning with tests/. Bug fix: non-reiterable values of the tests configuration variable are now handled correctly. Bug fix: an exceptions was raised if a problem had no test cases.
author Oleg Oshmyan <chortos@inbox.lv>
date Wed, 22 Sep 2010 23:34:51 +0000
parents f07b7a431ea6
children c23d81f4a1a3
line wrap: on
line diff
--- a/2.00/problem.py	Wed Sep 22 22:01:56 2010 +0000
+++ b/2.00/problem.py	Wed Sep 22 23:34:51 2010 +0000
@@ -58,6 +58,7 @@
 		raise NotImplementedError
 	
 	def test(prob):
+		case = None
 		try:
 			real = max = ntotal = nvalued = ncorrect = ncorrectvalued = 0
 			for case in prob.testcases:
@@ -153,7 +154,7 @@
 				say('Problem total: %d/%d tests; %g/%g points; weighted score: %g/%g' % (ncorrect, ntotal, real, max, weighted, prob.config.taskweight))
 			return weighted, prob.config.taskweight
 		finally:
-			if options.erase and (not prob.config.stdio or case.validator):
+			if options.erase and (not prob.config.stdio or case and case.validator):
 				for var in 'in', 'out':
 					name = getattr(prob.config, var + 'name')
 					if name: