confidence level; (generate_date_tests): Remove invalid dates.

svn: r7320
This commit is contained in:
Alex Roitman 2006-09-13 00:35:47 +00:00
parent eeddbe748b
commit f6a19173c4
2 changed files with 46 additions and 46 deletions

View File

@ -1,6 +1,6 @@
2006-09-12 Alex Roitman <shura@gramps-project.org> 2006-09-12 Alex Roitman <shura@gramps-project.org>
* src/plugins/TestcaseGenerator.py (fill_object): Use integer * src/plugins/TestcaseGenerator.py (fill_object): Use integer
confidence level. confidence level; (generate_date_tests): Remove invalid dates.
* src/DateHandler/_Date_fr.py (DateParserFR.init_strings): Typo. * src/DateHandler/_Date_fr.py (DateParserFR.init_strings): Typo.
* src/const.py.in (app_gramps): Revert to using a string. * src/const.py.in (app_gramps): Revert to using a string.

View File

@ -648,51 +648,51 @@ class TestcaseGenerator(Tool.Tool):
"This is a textual date") "This is a textual date")
dates.append( d) dates.append( d)
# test invalid dates ## # test invalid dates
dateval = (4,7,1789,False,5,8,1876,False) ## dateval = (4,7,1789,False,5,8,1876,False)
for l in range(1,len(dateval)): ## for l in range(1,len(dateval)):
d = RelLib.Date() ## d = RelLib.Date()
try: ## try:
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE, ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE,
RelLib.Date.CAL_GREGORIAN,dateval[:l],"Text comment") ## RelLib.Date.CAL_GREGORIAN,dateval[:l],"Text comment")
dates.append( d) ## dates.append( d)
except Errors.DateError, e: ## except Errors.DateError, e:
d.set_as_text("Date identified value correctly as invalid.\n%s" % e) ## d.set_as_text("Date identified value correctly as invalid.\n%s" % e)
dates.append( d) ## dates.append( d)
except: ## except:
d = RelLib.Date() ## d = RelLib.Date()
d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),)) ## d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
dates.append( d) ## dates.append( d)
for l in range(1,len(dateval)): ## for l in range(1,len(dateval)):
d = RelLib.Date() ## d = RelLib.Date()
try: ## try:
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN,RelLib.Date.CAL_GREGORIAN,dateval[:l],"Text comment") ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN,RelLib.Date.CAL_GREGORIAN,dateval[:l],"Text comment")
dates.append( d) ## dates.append( d)
except Errors.DateError, e: ## except Errors.DateError, e:
d.set_as_text("Date identified value correctly as invalid.\n%s" % e) ## d.set_as_text("Date identified value correctly as invalid.\n%s" % e)
dates.append( d) ## dates.append( d)
except: ## except:
d = RelLib.Date() ## d = RelLib.Date()
d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),)) ## d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
dates.append( d) ## dates.append( d)
d = RelLib.Date() ## d = RelLib.Date()
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE, ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE,
RelLib.Date.CAL_GREGORIAN,(44,7,1789,False),"Text comment") ## RelLib.Date.CAL_GREGORIAN,(44,7,1789,False),"Text comment")
dates.append( d) ## dates.append( d)
d = RelLib.Date() ## d = RelLib.Date()
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE, ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_NONE,
RelLib.Date.CAL_GREGORIAN,(4,77,1789,False),"Text comment") ## RelLib.Date.CAL_GREGORIAN,(4,77,1789,False),"Text comment")
dates.append( d) ## dates.append( d)
d = RelLib.Date() ## d = RelLib.Date()
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN, ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN,
RelLib.Date.CAL_GREGORIAN, ## RelLib.Date.CAL_GREGORIAN,
(4,7,1789,False,55,8,1876,False),"Text comment") ## (4,7,1789,False,55,8,1876,False),"Text comment")
dates.append( d) ## dates.append( d)
d = RelLib.Date() ## d = RelLib.Date()
d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN, ## d.set(RelLib.Date.QUAL_NONE,RelLib.Date.MOD_SPAN,
RelLib.Date.CAL_GREGORIAN, ## RelLib.Date.CAL_GREGORIAN,
(4,7,1789,False,5,88,1876,False),"Text comment") ## (4,7,1789,False,5,88,1876,False),"Text comment")
dates.append( d) ## dates.append( d)
# now add them as birth to new persons # now add them as birth to new persons
for dateval in dates: for dateval in dates: