summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index dbe25ef..25a3015 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -510,6 +510,7 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
def test_constructor(self):
eq = self.assertEqual
+ ra = self.assertRaises
td = timedelta
# Check keyword args to constructor
@@ -533,6 +534,15 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
eq(td(seconds=0.001), td(milliseconds=1))
eq(td(milliseconds=0.001), td(microseconds=1))
+ # Check type of args to constructor
+ ra(TypeError, lambda: td(weeks='1'))
+ ra(TypeError, lambda: td(days='1'))
+ ra(TypeError, lambda: td(hours='1'))
+ ra(TypeError, lambda: td(minutes='1'))
+ ra(TypeError, lambda: td(seconds='1'))
+ ra(TypeError, lambda: td(milliseconds='1'))
+ ra(TypeError, lambda: td(microseconds='1'))
+
def test_computations(self):
eq = self.assertEqual
td = timedelta