mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	#18453: merge with 3.3.
This commit is contained in:
		
						commit
						8281e7c24c
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
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 @@ def test_dotted_attribute(self):
 | 
			
		|||
 | 
			
		||||
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 @@ def test_decode(self):
 | 
			
		|||
        self.assertEqual(t1, tref)
 | 
			
		||||
 | 
			
		||||
        t2 = xmlrpclib._datetime(d)
 | 
			
		||||
        self.assertEqual(t1, tref)
 | 
			
		||||
        self.assertEqual(t2, tref)
 | 
			
		||||
 | 
			
		||||
    def test_comparison(self):
 | 
			
		||||
        now = datetime.datetime.now()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue