Refs #27025 -- Fixed a timezone test for Python 3.6.

Reflects behavior changes in PEP 495 (Local Time Disambiguation).
This commit is contained in:
Tim Graham 2016-09-17 12:12:52 -04:00
parent 8119b679eb
commit e43ea36b76
1 changed files with 8 additions and 2 deletions

View File

@ -193,8 +193,14 @@ class TimezoneTests(SimpleTestCase):
pytz.timezone("Asia/Bangkok").localize(datetime.datetime(2011, 9, 1, 17, 20, 30)), CET pytz.timezone("Asia/Bangkok").localize(datetime.datetime(2011, 9, 1, 17, 20, 30)), CET
), ),
datetime.datetime(2011, 9, 1, 12, 20, 30)) datetime.datetime(2011, 9, 1, 12, 20, 30))
with self.assertRaises(ValueError): if PY36:
timezone.make_naive(datetime.datetime(2011, 9, 1, 12, 20, 30), CET) self.assertEqual(
timezone.make_naive(datetime.datetime(2011, 9, 1, 12, 20, 30), CET),
datetime.datetime(2011, 9, 1, 19, 20, 30)
)
else:
with self.assertRaises(ValueError):
timezone.make_naive(datetime.datetime(2011, 9, 1, 12, 20, 30), CET)
@requires_pytz @requires_pytz
def test_make_aware_pytz_ambiguous(self): def test_make_aware_pytz_ambiguous(self):