summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-07-25 22:00:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-07-25 22:00:30 (GMT)
commita22d8231a3821e3b11c2153bef7970fb260e6860 (patch)
tree2bdb4c696f9ff39032b7fc8445b0e81526e51688 /Lib/test/datetimetester.py
parent19e020c5c713fcf24d66d72f5e599d57e8841360 (diff)
parent5a2146a2fdb9b8adf6472f1bedbba68c41bab232 (diff)
downloadcpython-a22d8231a3821e3b11c2153bef7970fb260e6860.zip
cpython-a22d8231a3821e3b11c2153bef7970fb260e6860.tar.gz
cpython-a22d8231a3821e3b11c2153bef7970fb260e6860.tar.bz2
merge
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index b8c6138..34a8d63 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -5,6 +5,7 @@ See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
import sys
import pickle
+import random
import unittest
from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod
@@ -76,8 +77,18 @@ class PicklableFixedOffset(FixedOffset):
def __init__(self, offset=None, name=None, dstoffset=None):
FixedOffset.__init__(self, offset, name, dstoffset)
+class _TZInfo(tzinfo):
+ def utcoffset(self, datetime_module):
+ return random.random()
+
class TestTZInfo(unittest.TestCase):
+ def test_refcnt_crash_bug_22044(self):
+ tz1 = _TZInfo()
+ dt1 = datetime(2014, 7, 21, 11, 32, 3, 0, tz1)
+ with self.assertRaises(TypeError):
+ dt1.utcoffset()
+
def test_non_abstractness(self):
# In order to allow subclasses to get pickled, the C implementation
# wasn't able to get away with having __init__ raise