From e097fb58c3aefed607fb79bc3c8a426420da4b0b Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Fri, 15 Nov 2013 15:38:04 +0200 Subject: [PATCH] 7197: failing tests demonstrating the bug Merge from master: commit 93ca90f3b8b02c02e0dcdfad7011b541cac558e3 Author: Vassilii Khachaturov Date: Thu Nov 14 22:41:46 2013 +0200 7197: more failing tests commit 78cae43a32cfa7def822a17b40acafecab876817 Author: Vassilii Khachaturov 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 Date: Wed Nov 13 13:52:47 2013 +0200 7197: failing test demonstrating the bug --- .../gen/datehandler/test/datehandler_test.py | 35 ++++++++++++------- gramps/gen/lib/test/date_test.py | 3 ++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/gramps/gen/datehandler/test/datehandler_test.py b/gramps/gen/datehandler/test/datehandler_test.py index 9e52d6894..683e6e144 100644 --- a/gramps/gen/datehandler/test/datehandler_test.py +++ b/gramps/gen/datehandler/test/datehandler_test.py @@ -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) diff --git a/gramps/gen/lib/test/date_test.py b/gramps/gen/lib/test/date_test.py index 767a25893..0c3b37af8 100644 --- a/gramps/gen/lib/test/date_test.py +++ b/gramps/gen/lib/test/date_test.py @@ -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):