13 Star 0 Fork 2

ocs-upgrade/babel

forked from OpenCloudOS Stream/babel 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Freeze-format_time-tests-to-a-specific-date-to-fix-t.patch 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
kianli 提交于 2023-07-19 19:55 . Upgrade to 2.12.1
From 8b152dbe47cb830f66ad12bd3057e6128aeac072 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Tue, 9 May 2023 10:20:04 +0200
Subject: [PATCH] Freeze format_time() tests to a specific date to fix test
failures (#998)
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.
---
tests/test_dates.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/test_dates.py b/tests/test_dates.py
index b94c710..3f1fc3f 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -601,12 +601,13 @@ def test_format_time(timezone_getter):
custom = dates.format_time(t, "hh 'o''clock' a, zzzz", tzinfo=eastern, locale='en')
assert custom == "09 o'clock AM, Eastern Daylight Time"
- t = time(15, 30)
- paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
- assert paris == '15:30:00 heure normale d’Europe centrale'
+ with freezegun.freeze_time("2023-01-01"):
+ t = time(15, 30)
+ paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
+ assert paris == '15:30:00 heure normale d’Europe centrale'
- us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
- assert us_east == '3:30:00\u202fPM Eastern Standard Time'
+ us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
+ assert us_east == '3:30:00\u202fPM Eastern Standard Time'
def test_format_skeleton(timezone_getter):
--
2.37.3
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ocs-upgrade/babel.git
git@gitee.com:ocs-upgrade/babel.git
ocs-upgrade
babel
babel
master

搜索帮助