python-pytz/0001-Fix-tests-for-older-timezone-versions.patch

82 lines
2.9 KiB
Diff

From ba0f4aa2cb32d3e0338c389a0ee32ae8ceb1f367 Mon Sep 17 00:00:00 2001
From: Thomas Bechtold <tbechtold@suse.com>
Date: Wed, 28 Jun 2017 12:28:31 +0200
Subject: [PATCH] Fix tests for older timezone versions
This improves the fix from commit c00dbe290b .
---
src/pytz/tests/test_tzinfo.py | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
Index: pytz-2022.2.1/pytz/tests/test_tzinfo.py
===================================================================
--- pytz-2022.2.1.orig/pytz/tests/test_tzinfo.py
+++ pytz-2022.2.1/pytz/tests/test_tzinfo.py
@@ -253,12 +253,13 @@ class USEasternDSTStartTestCase(unittest
def _test_tzname(self, utc_dt, wanted):
tzname = wanted['tzname']
+ if not isinstance(tzname, list):
+ tzname = [tzname]
dt = utc_dt.astimezone(self.tzinfo)
- self.assertEqual(
- dt.tzname(), tzname,
- 'Expected %s as tzname for %s. Got %s' % (
- tzname, str(utc_dt), dt.tzname()
- )
+ self.assertIn(dt.tzname(), tzname,
+ 'Expected %s as tzname for %s. Got %s' % (
+ tzname, str(utc_dt), dt.tzname()
+ )
)
def _test_utcoffset(self, utc_dt, wanted):
@@ -516,7 +517,7 @@ class NoumeaHistoryStartTestCase(USEaste
'dst': timedelta(0),
}
after = {
- 'tzname': '+11', # pre-2017a, NCT
+ 'tzname': ['+11', 'NCT'], # pre-2017a, NCT
'utcoffset': timedelta(hours=11),
'dst': timedelta(0),
}
@@ -527,12 +528,12 @@ class NoumeaDSTEndTestCase(USEasternDSTS
tzinfo = pytz.timezone('Pacific/Noumea')
transition_time = datetime(1997, 3, 1, 15, 00, 00, tzinfo=UTC)
before = {
- 'tzname': '+12', # pre-2017a, NCST
+ 'tzname': ['+12', 'NCST'], # pre-2017a, NCST
'utcoffset': timedelta(hours=12),
'dst': timedelta(hours=1),
}
after = {
- 'tzname': '+11', # pre-2017a, NCT
+ 'tzname': ['+11', 'NCT'], # pre-2017a, NCT
'utcoffset': timedelta(hours=11),
'dst': timedelta(0),
}
@@ -556,7 +557,7 @@ class TahitiTestCase(USEasternDSTStartTe
'dst': timedelta(0),
}
after = {
- 'tzname': '-10', # pre-2017a, TAHT
+ 'tzname': ['-10', 'TAHT'], # pre-2017a, TAHT
'utcoffset': timedelta(hours=-10),
'dst': timedelta(0),
}
@@ -569,12 +570,12 @@ class SamoaInternationalDateLineChange(U
tzinfo = pytz.timezone('Pacific/Apia')
transition_time = datetime(2011, 12, 30, 10, 0, 0, tzinfo=UTC)
before = {
- 'tzname': '-10', # pre-2017a, SDT
+ 'tzname': ['-10', 'SDT'], # pre-2017a, SDT
'utcoffset': timedelta(hours=-10),
'dst': timedelta(hours=1),
}
after = {
- 'tzname': '+14', # pre-2017a, WSDT
+ 'tzname': ['+14', 'WSDT'], # pre-2017a, WSDT
'utcoffset': timedelta(hours=14),
'dst': timedelta(hours=1),
}