diff options
author | BT-sschmid <39914536+BT-sschmid@users.noreply.github.com> | 2019-03-01 12:00:44 +0100 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2019-03-01 13:00:44 +0200 |
commit | ea5bc4988bf7c3be84d296eb874aa11ed86c907d (patch) | |
tree | be4fea1c2b23e9ead65bce3689ae8028f7bd0d6b /tests | |
parent | 60af039d9b282b46e37f6f8556005c339f5c24a2 (diff) | |
download | babel-ea5bc4988bf7c3be84d296eb874aa11ed86c907d.tar.gz |
fixes #619 wrong weeknumber for 31.12.2018 (#621)
The weeknumber was calculated to 53, but by definition the value must compute to 1.
the fix will compute the weeknumber by using date.isocalendar if locale.first_week_day == 0.
Also the computation of the year format 'YYYY' is replaced by isocalendar.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_dates.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_dates.py b/tests/test_dates.py index b8c293b..d77c0ea 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -79,6 +79,15 @@ class DateTimeFormatTestCase(unittest.TestCase): fmt = dates.DateTimeFormat(d, locale='en_US') self.assertEqual('53', fmt['w']) + def test_week_of_year_de_first_us_last_with_year(self): + d = date(2018,12,31) + fmt = dates.DateTimeFormat(d, locale='de_DE') + self.assertEqual('1', fmt['w']) + self.assertEqual('2019', fmt['YYYY']) + fmt = dates.DateTimeFormat(d, locale='en_US') + self.assertEqual('53', fmt['w']) + self.assertEqual('2018',fmt['yyyy']) + def test_week_of_month_first(self): d = date(2006, 1, 8) fmt = dates.DateTimeFormat(d, locale='de_DE') |