Skip to content

Commit

Permalink
Merge pull request #116 from moreati/deprecation-warnings
Browse files Browse the repository at this point in the history
Fix DeprecationWarnings whilst running the unit tests
  • Loading branch information
pganssle committed Sep 8, 2015
2 parents e7fc57e + d871cb5 commit 083f666
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions dateutil/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import time as _time

from six import StringIO, BytesIO, PY3
from six import assertRaisesRegex, StringIO, BytesIO, PY3

try:
# python2.6 unittest has no skipUnless. So we use unittest2.
Expand Down Expand Up @@ -5517,9 +5517,12 @@ def testErrorType01(self):
parse, 'shouldfail')

def testCorrectErrorOnFuzzyWithTokens(self):
self.assertRaisesRegexp(ValueError, 'Unknown string format', parse, '04/04/32/423', fuzzy_with_tokens=True)
self.assertRaisesRegexp(ValueError, 'Unknown string format', parse, '04/04/04 +32423', fuzzy_with_tokens=True)
self.assertRaisesRegexp(ValueError, 'Unknown string format', parse, '04/04/0d4', fuzzy_with_tokens=True)
assertRaisesRegex(self, ValueError, 'Unknown string format',
parse, '04/04/32/423', fuzzy_with_tokens=True)
assertRaisesRegex(self, ValueError, 'Unknown string format',
parse, '04/04/04 +32423', fuzzy_with_tokens=True)
assertRaisesRegex(self, ValueError, 'Unknown string format',
parse, '04/04/0d4', fuzzy_with_tokens=True)

def testIncreasingCTime(self):
# This test will check 200 different years, every month, every day,
Expand Down Expand Up @@ -5866,12 +5869,12 @@ def testRangeCmp2(self):
tzrange("EST", -18000, "EDT"))

def testFileStart1(self):
tz = tzfile(BytesIO(base64.decodestring(self.TZFILE_EST5EDT)))
tz = tzfile(BytesIO(base64.b64decode(self.TZFILE_EST5EDT)))
self.assertEqual(datetime(2003, 4, 6, 1, 59, tzinfo=tz).tzname(), "EST")
self.assertEqual(datetime(2003, 4, 6, 2, 00, tzinfo=tz).tzname(), "EDT")

def testFileEnd1(self):
tz = tzfile(BytesIO(base64.decodestring(self.TZFILE_EST5EDT)))
tz = tzfile(BytesIO(base64.b64decode(self.TZFILE_EST5EDT)))
self.assertEqual(datetime(2003, 10, 26, 0, 59, tzinfo=tz).tzname(),
"EDT")
self.assertEqual(datetime(2003, 10, 26, 1, 00, tzinfo=tz).tzname(),
Expand Down Expand Up @@ -5919,14 +5922,14 @@ def testICalEnd1(self):

def testRoundNonFullMinutes(self):
# This timezone has an offset of 5992 seconds in 1900-01-01.
tz = tzfile(BytesIO(base64.decodestring(self.EUROPE_HELSINKI)))
tz = tzfile(BytesIO(base64.b64decode(self.EUROPE_HELSINKI)))
self.assertEqual(str(datetime(1900, 1, 1, 0, 0, tzinfo=tz)),
"1900-01-01 00:00:00+01:40")

def testLeapCountDecodesProperly(self):
# This timezone has leapcnt, and failed to decode until
# Eugene Oden notified about the issue.
tz = tzfile(BytesIO(base64.decodestring(self.NEW_YORK)))
tz = tzfile(BytesIO(base64.b64decode(self.NEW_YORK)))
self.assertEqual(datetime(2007, 3, 31, 20, 12).tzname(), None)

def testGettz(self):
Expand Down

0 comments on commit 083f666

Please sign in to comment.