diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 15:37:36 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 15:37:36 (GMT) |
commit | 8281e7c24c08debff65f41a1e8c81ba8e6d5250b (patch) | |
tree | 65c51e58ecc360d89947539275c13a0a05bb4f60 /Lib/test/test_xmlrpc.py | |
parent | 06c9ab56662b1fb6911719a0404a8716e5db0984 (diff) | |
parent | 319163244aa00dd17c021aea0775c94a13bc8c97 (diff) | |
download | cpython-8281e7c24c08debff65f41a1e8c81ba8e6d5250b.zip cpython-8281e7c24c08debff65f41a1e8c81ba8e6d5250b.tar.gz cpython-8281e7c24c08debff65f41a1e8c81ba8e6d5250b.tar.bz2 |
#18453: merge with 3.3.
Diffstat (limited to 'Lib/test/test_xmlrpc.py')
-rw-r--r-- | Lib/test/test_xmlrpc.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 31d735e..7fc52e3 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -3,6 +3,7 @@ import datetime import sys import time import unittest +from unittest import mock import xmlrpc.client as xmlrpclib import xmlrpc.server import http.client @@ -253,7 +254,14 @@ class FaultTestCase(unittest.TestCase): class DateTimeTestCase(unittest.TestCase): def test_default(self): - t = xmlrpclib.DateTime() + with mock.patch('time.localtime') as localtime_mock: + time_struct = time.struct_time( + [2013, 7, 15, 0, 24, 49, 0, 196, 0]) + localtime_mock.return_value = time_struct + localtime = time.localtime() + t = xmlrpclib.DateTime() + self.assertEqual(str(t), + time.strftime("%Y%m%dT%H:%M:%S", localtime)) def test_time(self): d = 1181399930.036952 @@ -290,7 +298,7 @@ class DateTimeTestCase(unittest.TestCase): self.assertEqual(t1, tref) t2 = xmlrpclib._datetime(d) - self.assertEqual(t1, tref) + self.assertEqual(t2, tref) def test_comparison(self): now = datetime.datetime.now() |