summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-14 22:01:58 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-14 22:01:58 (GMT)
commit8b7a9a38c66aff5633255b63be639ee8592f180b (patch)
tree3e385d0dbb502e732aaa613464eef7ad3b51a186 /Lib/test
parent4dcdb78c6ffd203c9d72ef41638cc4a0e3857adf (diff)
downloadcpython-8b7a9a38c66aff5633255b63be639ee8592f180b.zip
cpython-8b7a9a38c66aff5633255b63be639ee8592f180b.tar.gz
cpython-8b7a9a38c66aff5633255b63be639ee8592f180b.tar.bz2
The date class is now properly subclassable. (SF bug #720908)
(This is only the tip of the iceberg; the time and datetime classes need the same treatment.)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_datetime.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 9532a2a..b86286b 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -479,6 +479,12 @@ class TestDateOnly(unittest.TestCase):
dt2 = dt - delta
self.assertEqual(dt2, dt - days)
+ def test_subclass_date(self):
+ class C(date):
+ theAnswer = 42
+ dt = C(2003, 4, 14)
+ self.assertEqual(dt.__class__, C)
+
class TestDate(HarmlessMixedComparison):
# Tests here should pass for both dates and datetimes, except for a
# few tests that TestDateTime overrides.