diff options
author | Juliette Monsel <j_4321@protonmail.com> | 2019-07-20 19:19:12 +0200 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2022-01-28 11:07:09 +0200 |
commit | 8a5e4bdb7f40bfbd8f6f0f6f22479e6f0f190da1 (patch) | |
tree | 30b7e99b81cb215c2a7a117e4430e8f7cbe930b8 /tests | |
parent | 335884add64c6317ea74d1362ace6f79e449dfd7 (diff) | |
download | babel-8a5e4bdb7f40bfbd8f6f0f6f22479e6f0f190da1.tar.gz |
Add format argument to parse_*
``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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_dates.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test_dates.py b/tests/test_dates.py index c4b9f46..2a883ab 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -775,6 +775,7 @@ def test_format_timedelta(): def test_parse_date(): assert dates.parse_date('4/1/04', locale='en_US') == date(2004, 4, 1) assert dates.parse_date('01.04.2004', locale='de_DE') == date(2004, 4, 1) + assert dates.parse_date('2004-04-01', locale='sv_SE', format='short') == date(2004, 4, 1) @pytest.mark.parametrize('input, expected', [ |