diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/README.rst | 2 | ||||
-rw-r--r-- | src/pytz/tests/test_tzinfo.py | 51 |
3 files changed, 4 insertions, 51 deletions
@@ -142,7 +142,7 @@ upload_docs_pythonhosted: docs touch $@ .stamp-zoneinfo: - ${MAKE} -C ${IANA} ZFLAGS='-b fat' PACKRATDATA=backzone TOPDIR=`pwd`/build USRDIR= USRSHAREDIR=etc install + ${MAKE} -C ${IANA} ZFLAGS='-b fat' PACKRATDATA= TOPDIR=`pwd`/build USRDIR= USRSHAREDIR=etc install # Break hard links, working around http://bugs.python.org/issue8876. for d in zoneinfo zoneinfo-leaps zoneinfo-posix; do \ rm -rf `pwd`/build/etc/$$d.tmp; \ diff --git a/src/README.rst b/src/README.rst index 5f50692..cbf3535 100644 --- a/src/README.rst +++ b/src/README.rst @@ -91,7 +91,7 @@ Unfortunately using the tzinfo argument of the standard datetime constructors ''does not work'' with pytz for many timezones. >>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt) # /!\ Does not work this way! -'2002-10-27 12:00:00 LMT+0020' +'2002-10-27 12:00:00 LMT+0018' It is safe for timezones without daylight saving transitions though, such as UTC: diff --git a/src/pytz/tests/test_tzinfo.py b/src/pytz/tests/test_tzinfo.py index fe396ea..3e3d6f2 100644 --- a/src/pytz/tests/test_tzinfo.py +++ b/src/pytz/tests/test_tzinfo.py @@ -612,33 +612,6 @@ class ReferenceUSEasternDSTEndTestCase(USEasternDSTEndTestCase): class LocalTestCase(unittest.TestCase): def testLocalize(self): - loc_tz = pytz.timezone('Europe/Amsterdam') - - loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0)) - # Actually +00:19:32, but Python datetime rounds this - self.assertEqual(loc_time.strftime('%Z%z'), 'AMT+0020') - - loc_time = loc_tz.localize(datetime(1930, 5, 20, 0, 0, 0)) - # Actually +00:19:32, but Python datetime rounds this - self.assertEqual(loc_time.strftime('%Z%z'), 'NST+0120') - - loc_time = loc_tz.localize(datetime(1940, 5, 10, 0, 0, 0)) - # pre-2017a, abbreviation was NCT - self.assertEqual(loc_time.strftime('%Z%z'), '+0020+0020') - - loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0)) - self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') - - loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0)) - self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') - - loc_time = loc_tz.localize(datetime(2004, 4, 1, 0, 0, 0)) - self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') - - loc_time = loc_tz.localize(datetime(1943, 3, 29, 1, 59, 59)) - self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') - - # Switch to US loc_tz = pytz.timezone('US/Eastern') # End of DST ambiguity check @@ -712,26 +685,6 @@ class LocalTestCase(unittest.TestCase): '2004-04-04 01:50:00 EST-0500' ) - def testPartialMinuteOffsets(self): - # utcoffset in Amsterdam was not a whole minute until 1937 - # However, we fudge this by rounding them, as the Python - # datetime library - tz = pytz.timezone('Europe/Amsterdam') - utc_dt = datetime(1914, 1, 1, 13, 40, 28, tzinfo=UTC) # correct - utc_dt = utc_dt.replace(second=0) # But we need to fudge it - loc_dt = utc_dt.astimezone(tz) - self.assertEqual( - loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), - '1914-01-01 14:00:00 AMT+0020' - ) - - # And get back... - utc_dt = loc_dt.astimezone(UTC) - self.assertEqual( - utc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), - '1914-01-01 13:40:00 UTC+0000' - ) - def no_testCreateLocaltime(self): # It would be nice if this worked, but it doesn't. tz = pytz.timezone('Europe/Amsterdam') @@ -759,8 +712,8 @@ class CommonTimezonesTestCase(unittest.TestCase): def test_belfast(self): self.assertTrue('Europe/Belfast' in pytz.all_timezones_set) - self.assertTrue('Europe/Belfast' in pytz.common_timezones) - self.assertTrue('Europe/Belfast' in pytz.common_timezones_set) + self.assertFalse('Europe/Belfast' in pytz.common_timezones) + self.assertFalse('Europe/Belfast' in pytz.common_timezones_set) class ZoneCaseInsensitivityTestCase(unittest.TestCase): |