7197: failing tests demonstrating the bug

Merge from master:
	commit 93ca90f3b8
	Author: Vassilii Khachaturov <vassilii@tarunz.org>
	Date:   Thu Nov 14 22:41:46 2013 +0200

		7197: more failing tests

	commit 78cae43a32
	Author: Vassilii Khachaturov <vassilii@tarunz.org>
	Date:   Wed Nov 13 16:59:26 2013 +0200

		7197: better diagnostics from test for debugging

		Use unittest -v/--verbose flag to trigger it.

	commit 626353a0b3
	Author: Vassilii Khachaturov <vassilii@tarunz.org>
	Date:   Wed Nov 13 13:52:47 2013 +0200

		7197: failing test demonstrating the bug
This commit is contained in:
Vassilii Khachaturov 2013-11-15 15:38:04 +02:00
parent 6514aed725
commit e097fb58c3
2 changed files with 26 additions and 12 deletions

View File

@ -34,8 +34,16 @@ Based on the Check Localized Date Displayer and Parser tool.
# standard python modules
#
#-------------------------------------------------------------------------
from __future__ import unicode_literals, division
import unittest
import sys
if '-v' in sys.argv or '--verbose' in sys.argv:
import logging
logging.getLogger('').addHandler(logging.StreamHandler())
log = logging.getLogger(".Date")
log.setLevel(logging.DEBUG)
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -69,18 +77,21 @@ class DateHandlerTest(unittest.TestCase):
def test_simple(self):
dates = []
calendar = Date.CAL_GREGORIAN
for quality in (Date.QUAL_NONE, Date.QUAL_ESTIMATED,
Date.QUAL_CALCULATED):
for modifier in (Date.MOD_NONE, Date.MOD_BEFORE,
Date.MOD_AFTER, Date.MOD_ABOUT):
for slash1 in (False,True):
for month in range(1, 13):
for day in (5, 27):
d = Date()
d.set(quality, modifier, calendar,
(day, month, 1789, slash1), "Text comment")
dates.append(d)
for calendar in (Date.CAL_GREGORIAN, Date.CAL_JULIAN):
for newyear in (Date.NEWYEAR_JAN1, Date.NEWYEAR_MAR25, (5,5)):
for quality in (Date.QUAL_NONE, Date.QUAL_ESTIMATED,
Date.QUAL_CALCULATED):
for modifier in (Date.MOD_NONE, Date.MOD_BEFORE,
Date.MOD_AFTER, Date.MOD_ABOUT):
for slash1 in (False,True):
for month in range(1, 13):
for day in (5, 27):
d = Date()
d.set(quality, modifier, calendar,
(day, month, 1789, slash1),
"Text comment",
newyear)
dates.append(d)
for test_date in dates:
self.base_test(test_date)

View File

@ -347,6 +347,9 @@ class MatchDateTest(BaseDateTest):
# See bug# 7100
("1233-12-01", "1234-12-01 (Mar25)", True),
("1234-01-04", "1234-01-04 (Mar25)", True),
# See bug# 7197
("1788-03-27", "1789-03-27 (Mar25)", True),
("1788-03-27 (Julian)", "1789-03-27 (Julian, Mar25)", True),
]
def do_test(self, d1, d2, expected1, expected2=None):