7197: failing tests demonstrating the bug

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

		7197: more failing tests

	commit 78cae43a32cfa7def822a17b40acafecab876817
	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 626353a0b3ef2fd9224e035fe706b9c2b175b87c
	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 # standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from __future__ import unicode_literals, division
import unittest 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 # GRAMPS modules
@ -69,18 +77,21 @@ class DateHandlerTest(unittest.TestCase):
def test_simple(self): def test_simple(self):
dates = [] dates = []
calendar = Date.CAL_GREGORIAN for calendar in (Date.CAL_GREGORIAN, Date.CAL_JULIAN):
for quality in (Date.QUAL_NONE, Date.QUAL_ESTIMATED, for newyear in (Date.NEWYEAR_JAN1, Date.NEWYEAR_MAR25, (5,5)):
Date.QUAL_CALCULATED): for quality in (Date.QUAL_NONE, Date.QUAL_ESTIMATED,
for modifier in (Date.MOD_NONE, Date.MOD_BEFORE, Date.QUAL_CALCULATED):
Date.MOD_AFTER, Date.MOD_ABOUT): for modifier in (Date.MOD_NONE, Date.MOD_BEFORE,
for slash1 in (False,True): Date.MOD_AFTER, Date.MOD_ABOUT):
for month in range(1, 13): for slash1 in (False,True):
for day in (5, 27): for month in range(1, 13):
d = Date() for day in (5, 27):
d.set(quality, modifier, calendar, d = Date()
(day, month, 1789, slash1), "Text comment") d.set(quality, modifier, calendar,
dates.append(d) (day, month, 1789, slash1),
"Text comment",
newyear)
dates.append(d)
for test_date in dates: for test_date in dates:
self.base_test(test_date) self.base_test(test_date)

View File

@ -347,6 +347,9 @@ class MatchDateTest(BaseDateTest):
# See bug# 7100 # See bug# 7100
("1233-12-01", "1234-12-01 (Mar25)", True), ("1233-12-01", "1234-12-01 (Mar25)", True),
("1234-01-04", "1234-01-04 (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): def do_test(self, d1, d2, expected1, expected2=None):