[Python-checkins] python/nondist/sandbox/datetime test_both.py,1.73,1.74
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
2002年12月13日 16:39:06 -0800
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv21032
Modified Files:
test_both.py
Log Message:
Since the tzinfo test_abstractness() no longer tested for abstractness,
changed it to test something more sensible.
Index: test_both.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -d -r1.73 -r1.74
*** test_both.py 14 Dec 2002 00:19:36 -0000 1.73
--- test_both.py 14 Dec 2002 00:39:04 -0000 1.74
***************
*** 59,67 ****
# tzinfo tests
- class NotEnough(tzinfo):
- def __init__(self, offset, name):
- self.__offset = offset
- self.__name = name
-
class FixedOffset(tzinfo):
def __init__(self, offset, name, dstoffset=42):
--- 59,62 ----
***************
*** 80,91 ****
class TestTZInfo(unittest.TestCase):
! def test_abstractness(self):
! return
# In order to allow subclasses to get pickled, the C implementation
# wasn't able to get away with having __init__ raise
! # NotImplementedError, so we no longer test this.
! self.assertRaises(NotImplementedError, tzinfo)
def test_subclass_must_override(self):
self.failUnless(issubclass(NotEnough, tzinfo))
ne = NotEnough(3, "NotByALongShot")
--- 75,93 ----
class TestTZInfo(unittest.TestCase):
! 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
! # NotImplementedError.
! useless = tzinfo()
! dt = datetime.datetime.max
! self.assertRaises(NotImplementedError, useless.tzname, dt)
! self.assertRaises(NotImplementedError, useless.utcoffset, dt)
! self.assertRaises(NotImplementedError, useless.dst, dt)
def test_subclass_must_override(self):
+ class NotEnough(tzinfo):
+ def __init__(self, offset, name):
+ self.__offset = offset
+ self.__name = name
self.failUnless(issubclass(NotEnough, tzinfo))
ne = NotEnough(3, "NotByALongShot")