diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 15:37:05 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 15:37:05 (GMT) |
commit | 319163244aa00dd17c021aea0775c94a13bc8c97 (patch) | |
tree | 95d6a5bed5a95d989d4349f66795316d83760d7f | |
parent | 0f12be15c635ea94cffde8d023a9183f15a8debd (diff) | |
download | cpython-319163244aa00dd17c021aea0775c94a13bc8c97.zip cpython-319163244aa00dd17c021aea0775c94a13bc8c97.tar.gz cpython-319163244aa00dd17c021aea0775c94a13bc8c97.tar.bz2 |
#18453: fix unused variables in test_xmlrpc. Patch by Vajrasky Kok.
-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 16f85c5..cc52259 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 @@ -249,7 +250,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 @@ -286,7 +294,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() |