comparison problem.py @ 94:b7fb64ce03d9

Fixed a couple of bugs
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 28 Feb 2011 21:35:25 +0000
parents c62c9bfd614a
children 523ba6907f3a
comparison
equal deleted inserted replaced
93:bd3fc9017f91 94:b7fb64ce03d9
30 del unixnames 30 del unixnames
31 31
32 __all__ = 'Problem', 'TestContext', 'test_context_end', 'TestGroup' 32 __all__ = 'Problem', 'TestContext', 'test_context_end', 'TestGroup'
33 33
34 def strerror(e): 34 def strerror(e):
35 s = getattr(e, 'strerror') 35 s = getattr(e, 'strerror', e)
36 if not s: s = str(e) 36 if not s: s = str(e)
37 return ' (%s%s)' % (s[0].lower(), s[1:]) if s else '' 37 return ' (%s%s)' % (s[0].lower(), s[1:]) if s else ''
38 38
39 class Cache(object): 39 class Cache(object):
40 def __init__(self, mydict): 40 def __init__(self, mydict):
168 verdict = 'cannot read the output file%s' % strerror(sys.exc_info()[1].upstream) 168 verdict = 'cannot read the output file%s' % strerror(sys.exc_info()[1].upstream)
169 except testcases.CannotReadInputFile: 169 except testcases.CannotReadInputFile:
170 verdict = 'cannot read the input file%s' % strerror(sys.exc_info()[1].upstream) 170 verdict = 'cannot read the input file%s' % strerror(sys.exc_info()[1].upstream)
171 except testcases.CannotReadAnswerFile: 171 except testcases.CannotReadAnswerFile:
172 verdict = 'cannot read the reference output file%s' % strerror(sys.exc_info()[1].upstream) 172 verdict = 'cannot read the reference output file%s' % strerror(sys.exc_info()[1].upstream)
173 except testcases.ExceptionWrapper:
174 verdict = 'unspecified reason [this may be a bug in test.py]%s' % strerror(sys.exc_info()[1].upstream)
173 except testcases.TestCaseNotPassed: 175 except testcases.TestCaseNotPassed:
174 verdict = 'unspecified reason [this may be a bug in test.py]%s' % strerror(sys.exc_info()[1]) 176 verdict = 'unspecified reason [this may be a bug in test.py]%s' % strerror(sys.exc_info()[1])
175 #except Exception: 177 #except Exception:
176 # verdict = 'unknown error [this may be a bug in test.py]%s' % strerror(sys.exc_info()[1]) 178 # verdict = 'unknown error [this may be a bug in test.py]%s' % strerror(sys.exc_info()[1])
177 else: 179 else: