From 4e2e51ff31bb14234ed21f91585bc9fb6d9fd011 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Fri, 25 Oct 2013 08:39:19 +0000 Subject: [PATCH] 7158: "today" parsing fails with other calendars Committed a test that uncovers this problem, before we add localization to the "today" string svn: r23393 --- gramps/gen/lib/test/date_test.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gramps/gen/lib/test/date_test.py b/gramps/gen/lib/test/date_test.py index 0c4c74206..fc18f3588 100644 --- a/gramps/gen/lib/test/date_test.py +++ b/gramps/gen/lib/test/date_test.py @@ -350,6 +350,7 @@ class MatchDateTest(BaseDateTest): ("1234-01-04", "1234-01-04 (Mar25)", True), # See bug# 7158 ("today", Today(), True), + ("today (Hebrew)", Today(), True), ] def convert_to_date(self, d): @@ -361,16 +362,20 @@ class MatchDateTest(BaseDateTest): """ if expected2 is None: expected2 = expected1 + + self.assertMatch(d1, d2, expected1) + self.assertMatch(d2, d1, expected2) + + def assertMatch(self, d1, d2, expected): date1 = self.convert_to_date(d1) date2 = self.convert_to_date(d2) - result = date2.match(date1) - self.assertEqual(result, expected1, - "'%s' did not match '%s'" % (d1, d2)) - - result = date1.match(date2) - self.assertEqual(result, expected2, - "'%s' did not match '%s'" % (d2, d1)) + self.assertEqual(result, expected, + "'{}' {} '{}'\n({} vs {})".format( + d1, + ("did not match" if expected else "matched"), + d2, + date1.to_struct(), date2.to_struct())) def test_match(self): for testdata in self.tests: