summaryrefslogtreecommitdiff
path: root/tests/test_dates.py
Commit message (Collapse)AuthorAgeFilesLines
* Freeze format_time() tests to a specific date to fix test failures (#998)HEADmasterMichał Górny2023-05-091-5/+6
| | | | | | | | Freeze the date when performing the tests for format_time() with a timezone specified. Since the time object does not specify a date, the formatter uses the format string specific to the current date. As a result, if the current DST state is different than when the test was last updated, it failed.
* Update copyright year to 2023Aarni Koskela2023-02-281-1/+1
|
* Adjust tests for CLDR 42Aarni Koskela2023-01-201-10/+10
| | | | | | | The space changes around English seem to be on purpose, see: * https://unicode-org.atlassian.net/browse/CLDR-14032 * https://github.com/unicode-org/cldr/commit/a83026ab8c8fa6ed88f1047c4d0c6089f88b7e5d
* Enable E741 (ambiguous variable name) lintAarni Koskela2023-01-181-9/+9
|
* Apply some small miscellaneous formatting fixesAarni Koskela2023-01-181-5/+7
|
* Apply ruff UP025 (unicode literal prefix) fixAarni Koskela2023-01-181-129/+129
|
* Apply ruff I category fixesAarni Koskela2023-01-181-1/+1
|
* Minor cleanups (#948)Aarni Koskela2023-01-181-31/+1
| | | | | * Add __all__s to be cleaner about re-exports * Move timezone_getter to conftest * Apply spelling corrections suggested by codespell
* Implement zoneinfo support and make pytz optional (#940)DS/Charlie2023-01-111-84/+99
|
* tests: Use pytest.raises() decorator where applicableAarni Koskela2022-05-101-16/+11
|
* tests: Use regular asserts instead of unittest functionsAarni Koskela2022-05-101-290/+173
| | | | | | Automated conversion initially applied with https://github.com/warlo/codemod-unittest-to-pytest-asserts, followed by some manual changes for brevity.
* Merge pull request #869 from jun66j5/date-period-symbolsAarni Koskela2022-05-101-1/+1
|\ | | | | Add support for `b` and `B` period symbols in time format
| * Add support for `b` and `B` period symbols in time formatJun Omae2022-04-291-1/+1
| |
* | Fix up some Python2-isms using pyupgradeAarni Koskela2022-05-101-1/+0
|/
* Add test for issue 798Aarni Koskela2022-04-201-0/+4
|
* Adjust tests for CLDR 40 dataAarni Koskela2022-04-081-3/+3
|
* Add format argument to parse_*Juliette Monsel2022-01-281-0/+1
| | | | | | | | | | | | | | ``parse_date()`` does not allow the user to specify the date's format and the 'medium' format is used by default in the call to ``get_date_format()`` on line 1144. This results in a failure to parse the date in short format for the locale 'sv_SE'. This commit adds the format argument to avoid this failure. The default value is set to 'medium' to preserve the old behavior. Fixes #657 Co-authored-by: Aarni Koskela <akx@iki.fi>
* Add and emit dates.ParseErrorAarni Koskela2022-01-281-0/+7
|
* Improve partial time parsingAarni Koskela2022-01-281-2/+21
| | | | | | | Refs #442 Co-authored-by: David Bauer <david.bauer009@gmail.com> Co-authored-by: Arthur Jovart <arthur@jovart.com>
* Update copyright year to 2022Aarni Koskela2022-01-251-1/+1
|
* Become 2.9.1Aarni Koskela2021-04-281-1/+1
| | | | | * Update copyright year * Update changelog
* Use Freezegun in test_format_current_momentAarni Koskela2020-11-121-12/+4
| | | | The earlier patch resulted in `unsupported operand type(s) for -: 'datetime' and 'datetime'` on Pypy3.
* Merge branch '2.8-maintenance' into masterAarni Koskela2020-11-111-1/+1
|\
| * Bump copyright year from 2019 to 2020Aarni Koskela2020-11-111-1/+1
| |
* | Handle ZoneInfo objects in get_timezone_location, get_timezone_name (#741)Alessio Bogon2020-11-101-40/+89
|/ | | Fixes #740
* Bump copyright year from 2018 to 2019Aarni Koskela2019-05-271-2/+2
|
* Skip alt=... for week data (minDays, firstDay, weekendStart, weekendEnd)Aarni Koskela2019-03-011-0/+6
| | | | Fixes #624
* fixes #619 wrong weeknumber for 31.12.2018 (#621)BT-sschmid2019-03-011-0/+9
| | | | | | | | 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.
* Download CLDR 33.0; fix test changesAarni Koskela2018-05-281-8/+8
|
* Rephrase copyright headers to link to the LICENSE file instead of COPYINGauthorsAarni Koskela2018-02-021-1/+1
| | | | Fixes #398
* Update copyright header years, and include the Babel teamAarni Koskela2018-02-021-2/+2
|
* Test that CLDR 32 properly formats Russian start-of-year dates.cldr-32Aarni Koskela2018-01-251-0/+7
| | | | Fixes #485
* cldr: use CLDR 31.0.1 (and fix test changes); see below!cldr-30Aarni Koskela2018-01-171-7/+7
| | | | | | | | | | | | | | | | | | | | CLDR 31.0 separated the GMT and UTC time zones, so formatting of that time zone has changed. Most notably, "UTC" replaces "+0000" when formatting the timezone. This could break code that expects +0000. A subset (the parts supported by Babel) of the migration guide from http://cldr.unicode.org/index/downloads/cldr-31: * The locales in the language-territory population tables have been changed to be the canonical format, dropping the script where it is the default. So "ku_Latn" changes to "ku". * Plural rules: The Portuguese plural rules have changed so that all (and only) integers and decimal fractions < 2 are singular. * Timezones: The GMT timezone has been split from the UTC timezone. * Timezones: New timezone bcp47 codes have been added. * Languages "hr" and "sr" are no longer a short distance apart, for political reasons. * The primary names for CZ changed from "Czech Republic" to "Czechia", with the longer name now the alternate.
* Properly fall back to `long` metazone names when short forms are no-inheritAarni Koskela2016-07-151-0/+22
| | | | | | Thanks to @stringtheory for the bug report! Fixes #428
* Fix the way local time is constructed in testsIsaac Jurado2016-05-291-1/+2
| | | | | | In summer time zones, the test for "get_timezone_name" failed because the construct used to obtain a local time did not deal properly with DST offsets. As recommended by pytz, it is better to convert to local time from UTC.
* dates: Use format context and fallback through widthsAarni Koskela2016-04-081-0/+5
| | | | | | | | `zh_Hant` locale data does not have names for the `am` and `pm` day periods in the `format`/`abbreviated` context, so fallback logic is added to deal with that eventuality. Fixes #378
* Add flake8 pre-commit hook and apply fixes.Lukas Balaga2016-03-071-3/+1
|
* Merge pull request #355 from lukas-b/lukas_add_pre_commit_and_apply_fixesAarni Koskela2016-03-031-18/+21
|\ | | | | Add pre-commit and apply fixes
| * Apply pre-commit fixes.Lukas Balaga2016-02-271-18/+21
| |
* | dates: Add additional pattern for week daySachin Paliwal2016-03-011-0/+27
| | | | | | | | Added test cases and additional pattern for Weekday format
* | dates: Add additional pattern for quarterSachin Paliwal2016-03-011-0/+6
| | | | | | | | Added test cases and additional pattern for quarter format
* | format_datetime: using 'S...S' format is incorrectiamshubh222016-02-291-2/+14
|/ | | | Fixes https://github.com/python-babel/babel/issues/350
* dates: Add iso8601 pattern timezone FormatSachin Paliwal2016-02-051-0/+123
| | | | https://github.com/python-babel/babel/issues/325
* dates: Add Features in get timezone functionsSachin Paliwal2016-02-051-2/+10
| | | | | | | Added argument 'return_z' and two values 'iso8601' and 'iso8601_short' in argument width in get_timezone_gmt(), 'return_city' argument is add in get_timezone_location() and 'return_zone' in get_timezone_name() so we can implement iso8601 timezone patterns.
* dates: DRY out the internal datetime conversion codeAarni Koskela2016-01-231-2/+24
|
* Add support for date-time skeletonsMichael Birtwell2016-01-041-0/+9
| | | | | | | | The skeletons for dates and times are described on http://cldr.unicode.org/translation/date-time-patterns under Additional Date-Time Formats. And are useful when you want to some more control over formatting dates and times but don't want to force all locales to use the same pattern.
* Update to CLDR 28 (with test updates)Aarni Koskela2015-12-211-3/+3
| | | | | | | | | | * Aside from the usual data changes, the provisional aa locale is no longer, so we can't use it for tests. Instead, ii is used (chosen by virtue of ii.xml being fairly small, i.e. probably as incomplete as aa). * ms_Latn_SG is not in use anymore either; use sr_Latn_ME instead. Closes #226 Closes #290
* Test that Lithuanian long-form dates are formatted with the correct genitive ↵Aarni Koskela2015-12-211-0/+7
| | | | | | form of the month Fixes #288
* Test invalid format_timedelta() format parametersAlex Willmer2015-09-101-0/+8
|
* Add format_timedelta(format='narrow') supportAlex Willmer2015-09-101-0/+8
|