Report format type of error
svn: r13307
This commit is contained in:
parent
7344dbda98
commit
435aca1e95
@ -208,12 +208,12 @@ for calendar in (Date.CAL_JULIAN,
|
|||||||
dates.append( d)
|
dates.append( d)
|
||||||
|
|
||||||
# CAL_SWEDISH - Swedish calendar 1700-03-01 -> 1712-02-30!
|
# CAL_SWEDISH - Swedish calendar 1700-03-01 -> 1712-02-30!
|
||||||
#with Context(Date.CAL_SWEDISH) as calendar:
|
with Context(Date.CAL_SWEDISH) as calendar:
|
||||||
# for year in range(1701, 1712):
|
for year in range(1701, 1712):
|
||||||
# for month in range(1,13):
|
for month in range(1,13):
|
||||||
# d = Date()
|
d = Date()
|
||||||
# d.set(quality,modifier,calendar,(4,month,year,False),"Text comment")
|
d.set(quality,modifier,calendar,(4,month,year,False),"Text comment")
|
||||||
# dates.append( d)
|
dates.append( d)
|
||||||
|
|
||||||
for calendar in (Date.CAL_HEBREW, Date.CAL_FRENCH):
|
for calendar in (Date.CAL_HEBREW, Date.CAL_FRENCH):
|
||||||
for month in range(1,14):
|
for month in range(1,14):
|
||||||
@ -232,11 +232,12 @@ qua_str = ["QUAL_NONE", "QUAL_ESTIMATED", "QUAL_CALCULATED"]
|
|||||||
formats = DateHandler.get_date_formats()
|
formats = DateHandler.get_date_formats()
|
||||||
|
|
||||||
class Eval(unittest.TestCase):
|
class Eval(unittest.TestCase):
|
||||||
def __init__(self, method_name, dateval, e1, e2, e3):
|
def __init__(self, method_name, dateval, e1, e2, e3, format):
|
||||||
self.__dict__[method_name] = lambda: eval_func(dateval, e1, e2, e3)
|
self.__dict__[method_name] = lambda: eval_func(dateval, e1, e2, e3,
|
||||||
|
format)
|
||||||
unittest.TestCase.__init__(self, method_name)
|
unittest.TestCase.__init__(self, method_name)
|
||||||
|
|
||||||
def eval_func(dateval, e1, e2, e3):
|
def eval_func(dateval, e1, e2, e3, format):
|
||||||
"""
|
"""
|
||||||
e1 is datestr = _dd.display(dateval)
|
e1 is datestr = _dd.display(dateval)
|
||||||
e2 is ndate = _dp.parse(datestr)
|
e2 is ndate = _dp.parse(datestr)
|
||||||
@ -246,9 +247,9 @@ def eval_func(dateval, e1, e2, e3):
|
|||||||
exec(e2)
|
exec(e2)
|
||||||
exec(e3)
|
exec(e3)
|
||||||
#print datestr, ndate, ntxt
|
#print datestr, ndate, ntxt
|
||||||
assert dateval.is_equal(ndate), ("date fails is_equal:\n"
|
assert dateval.is_equal(ndate), ("dateval fails is_equal in format %d:\n"
|
||||||
" '%s' != '%s'" %
|
" '%s' != '%s'" %
|
||||||
(datestr, ndate))
|
(format, dateval, ndate))
|
||||||
|
|
||||||
def suite3():
|
def suite3():
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
@ -263,7 +264,8 @@ def suite3():
|
|||||||
suite.addTest(Eval("test_eval%04d" % count, dateval,
|
suite.addTest(Eval("test_eval%04d" % count, dateval,
|
||||||
"datestr = _dd.display(dateval)",
|
"datestr = _dd.display(dateval)",
|
||||||
"ndate = _dp.parse(datestr)",
|
"ndate = _dp.parse(datestr)",
|
||||||
"ntxt = _dd.display(ndate)"))
|
"ntxt = _dd.display(ndate)",
|
||||||
|
format))
|
||||||
count += 1
|
count += 1
|
||||||
return suite
|
return suite
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user