#NEWLINE# def test_datetype( self ) : #NEWLINE# #INDENT# now_time_seconds = time . time ( ) #NEWLINE# now_datetime = datetime . datetime . utcfromtimestamp ( now_time_seconds ) #NEWLINE# now_timestamp = ( now_time_seconds * 1000.0 ) #NEWLINE# self . assertEqual ( DateType . serialize ( now_datetime , 0 ) , DateType . serialize ( now_timestamp , 0 ) ) #NEWLINE# expected = 0 #NEWLINE# self . assertEqual ( DateType . deserialize ( int64_pack ( ( 1000 * expected ) ) , 0 ) , datetime . datetime . utcfromtimestamp ( expected ) ) #NEWLINE# expected = ( 2 ** 33 ) #NEWLINE# self . assertEqual ( DateType . deserialize ( int64_pack ( ( 1000 * expected ) ) , 0 ) , datetime . datetime ( 2242 , 3 , 16 , 12 , 56 , 32 ) ) #NEWLINE# expected = ( - 770172256 ) #NEWLINE# self . assertEqual ( DateType . deserialize ( int64_pack ( ( 1000 * expected ) ) , 0 ) , datetime . datetime ( 1945 , 8 , 5 , 23 , 15 , 44 ) ) #NEWLINE# expected = 1424817268.274 #NEWLINE# self . assertEqual ( DateType . deserialize ( int64_pack ( int ( ( 1000 * expected ) ) ) , 0 ) , datetime . datetime ( 2015 , 2 , 24 , 22 , 34 , 28 , 274000 ) ) #NEWLINE# expected = 2177403010.123 #NEWLINE# self . assertEqual ( DateType . deserialize ( int64_pack ( int ( ( 1000 * expected ) ) ) , 0 ) , datetime . datetime ( 2038 , 12 , 31 , 10 , 10 , 10 , 123000 ) )