Skip to content

Commit 962d5bb

Browse files
bdrungkreiserlee
authored andcommitted
Replace legacy US/Eastern by America/New_York
To avoid needing to depend on tzdata-legacy, replace the legacy timezone `US/Eastern` by `America/New_York`. Forwarded: stub42/pytz#111 Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com> Gbp-Pq: Name Replace-legacy-US-Eastern-by-America-New_York.patch
1 parent 492412a commit 962d5bb

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

pytz/tests/test_tzinfo.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ def testUnknownOffsets(self):
9090
# This tzinfo behavior is required to make
9191
# datetime.time.{utcoffset, dst, tzname} work as documented.
9292

93-
dst_tz = pytz.timezone('US/Eastern')
93+
dst_tz = pytz.timezone('America/New_York')
9494

9595
# This information is not known when we don't have a date,
9696
# so return None per API.
9797
self.assertIsNone(dst_tz.utcoffset(None))
9898
self.assertIsNone(dst_tz.dst(None))
9999
# We don't know the abbreviation, but this is still a valid
100100
# tzname per the Python documentation.
101-
self.assertEqual(dst_tz.tzname(None), 'US/Eastern')
101+
self.assertEqual(dst_tz.tzname(None), 'America/New_York')
102102

103103
def clearCache(self):
104104
pytz._tzinfo_cache.clear()
@@ -108,12 +108,12 @@ def testUnicodeTimezone(self):
108108
# and traditional strings, and that the desired singleton is
109109
# returned.
110110
self.clearCache()
111-
eastern = pytz.timezone(unicode('US/Eastern'))
112-
self.assertIs(eastern, pytz.timezone('US/Eastern'))
111+
eastern = pytz.timezone(unicode('America/New_York'))
112+
self.assertIs(eastern, pytz.timezone('America/New_York'))
113113

114114
self.clearCache()
115-
eastern = pytz.timezone('US/Eastern')
116-
self.assertIs(eastern, pytz.timezone(unicode('US/Eastern')))
115+
eastern = pytz.timezone('America/New_York')
116+
self.assertIs(eastern, pytz.timezone(unicode('America/New_York')))
117117

118118
def testStaticTzInfo(self):
119119
# Ensure that static timezones are correctly detected,
@@ -196,11 +196,11 @@ def testOldPickles(self):
196196
# where created with pytz2006j
197197
east1 = pickle.loads(
198198
_byte_string(
199-
"cpytz\n_p\np1\n(S'US/Eastern'\np2\nI-18000\n"
199+
"cpytz\n_p\np1\n(S'America/New_York'\np2\nI-18000\n"
200200
"I0\nS'EST'\np3\ntRp4\n."
201201
)
202202
)
203-
east2 = pytz.timezone('US/Eastern').localize(
203+
east2 = pytz.timezone('America/New_York').localize(
204204
datetime(2006, 1, 1)).tzinfo
205205
self.assertIs(east1, east2)
206206

@@ -220,7 +220,7 @@ def testOldPickles(self):
220220

221221

222222
class USEasternDSTStartTestCase(unittest.TestCase):
223-
tzinfo = pytz.timezone('US/Eastern')
223+
tzinfo = pytz.timezone('America/New_York')
224224

225225
# 24 hours before DST changeover
226226
transition_time = datetime(2002, 4, 7, 7, 0, 0, tzinfo=UTC)
@@ -346,7 +346,7 @@ def testDayAfter(self):
346346

347347

348348
class USEasternDSTEndTestCase(USEasternDSTStartTestCase):
349-
tzinfo = pytz.timezone('US/Eastern')
349+
tzinfo = pytz.timezone('America/New_York')
350350
transition_time = datetime(2002, 10, 27, 6, 0, 0, tzinfo=UTC)
351351
before = {
352352
'tzname': 'EDT',
@@ -604,7 +604,7 @@ def test_arithmetic(self):
604604

605605
class LocalTestCase(unittest.TestCase):
606606
def testLocalize(self):
607-
loc_tz = pytz.timezone('US/Eastern')
607+
loc_tz = pytz.timezone('America/New_York')
608608

609609
# End of DST ambiguity check
610610
loc_time = loc_tz.localize(datetime(1918, 10, 27, 1, 59, 59), is_dst=1)
@@ -663,7 +663,7 @@ def testLocalize(self):
663663
self.assertEqual(loc_time.strftime(fmt), expected[not dst])
664664

665665
def testNormalize(self):
666-
tz = pytz.timezone('US/Eastern')
666+
tz = pytz.timezone('America/New_York')
667667
dt = datetime(2004, 4, 4, 7, 0, 0, tzinfo=UTC).astimezone(tz)
668668
dt2 = dt - timedelta(minutes=10)
669669
self.assertEqual(
@@ -699,8 +699,8 @@ def test_bratislava(self):
699699
self.assertIn('Europe/Bratislava', pytz.common_timezones_set)
700700

701701
def test_us_eastern(self):
702-
self.assertIn('US/Eastern', pytz.common_timezones)
703-
self.assertIn('US/Eastern', pytz.common_timezones_set)
702+
self.assertIn('America/New_York', pytz.common_timezones)
703+
self.assertIn('America/New_York', pytz.common_timezones_set)
704704

705705
def test_belfast(self):
706706
self.assertIn('Europe/Belfast', pytz.all_timezones_set)

0 commit comments

Comments
 (0)