mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
merge
This commit is contained in:
commit
a22d8231a3
4 changed files with 22 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue