summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-02 21:49:30 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-02 21:49:30 (GMT)
commit43746c37704861947179185b4c037e5f18f89a7c (patch)
tree3223ce1101db5f782c32888e83e64bae66290d09 /Lib/test/datetimetester.py
parent711120d8fd0445b33655101d72b0f576646bff9f (diff)
downloadcpython-43746c37704861947179185b4c037e5f18f89a7c.zip
cpython-43746c37704861947179185b4c037e5f18f89a7c.tar.gz
cpython-43746c37704861947179185b4c037e5f18f89a7c.tar.bz2
Closes #27661: Added tzinfo keyword argument to datetime.combine.
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 02deb7c..e71f3aa 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -2117,11 +2117,22 @@ class TestDateTime(TestDate):
self.assertRaises(TypeError, combine) # need an arg
self.assertRaises(TypeError, combine, d) # need two args
self.assertRaises(TypeError, combine, t, d) # args reversed
- self.assertRaises(TypeError, combine, d, t, 1) # too many args
+ self.assertRaises(TypeError, combine, d, t, 1) # wrong tzinfo type
+ self.assertRaises(TypeError, combine, d, t, 1, 2) # too many args
self.assertRaises(TypeError, combine, "date", "time") # wrong types
self.assertRaises(TypeError, combine, d, "time") # wrong type
self.assertRaises(TypeError, combine, "date", t) # wrong type
+ # tzinfo= argument
+ dt = combine(d, t, timezone.utc)
+ self.assertIs(dt.tzinfo, timezone.utc)
+ dt = combine(d, t, tzinfo=timezone.utc)
+ self.assertIs(dt.tzinfo, timezone.utc)
+ t = time()
+ dt = combine(dt, t)
+ self.assertEqual(dt.date(), d)
+ self.assertEqual(dt.time(), t)
+
def test_replace(self):
cls = self.theclass
args = [1, 2, 3, 4, 5, 6, 7]