diff options
author | Paul Ganssle <paul@ganssle.io> | 2018-08-14 10:55:56 -0400 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-08-14 11:17:51 -0400 |
commit | 6ecf2c43dd27c48cba25fbd0dc2451566f3bc2a0 (patch) | |
tree | 33283722dcc38f42cd6d233be5a2040539a6ab8d /dateutil | |
parent | 2e6138c75d01aade30554d6095d5aa112e8aa532 (diff) | |
download | dateutil-6ecf2c43dd27c48cba25fbd0dc2451566f3bc2a0.tar.gz |
Modify badzone test and add new xfail
The original badzone test fails for a different reason on Windows, so
that has been changed to a Windows-specific xfail for GH issue #802, and
a new cross-platform badzone test added.
Diffstat (limited to 'dateutil')
-rw-r--r-- | dateutil/test/test_tz.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/dateutil/test/test_tz.py b/dateutil/test/test_tz.py index a65d387..84416dd 100644 --- a/dateutil/test/test_tz.py +++ b/dateutil/test/test_tz.py @@ -8,6 +8,7 @@ from ._common import ComparesEqual from datetime import datetime, timedelta from datetime import time as dt_time from datetime import tzinfo +from six import PY2 from six import BytesIO, StringIO import unittest @@ -1076,9 +1077,21 @@ class GettzTest(unittest.TestCase, TzFoldMixin): @pytest.mark.gettz -def test_gettz_badzone(): - # Make sure passing a bad TZ string to gettz returns None - # GH #800 +@pytest.mark.parametrize('badzone', [ + 'Fake.Region/Abcdefghijklmnop', # Violates several tz project name rules +]) +def test_gettz_badzone(badzone): + # Make sure passing a bad TZ string to gettz returns None (GH #800) + tzi = tz.gettz(badzone) + assert tzi is None + + +@pytest.mark.gettz +@pytest.mark.xfail(IS_WIN and PY2, + reason='tzwin fails with non-unicode characters on 2.7') +def test_gettz_badzone_unicode(): + # Make sure a unicode string can be passed to TZ (GH #802) + # When fixed, combine this with test_gettz_badzone tzi = tz.gettz('🐼') assert tzi is None |