<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import unittest <EOL> from google . cloud . dataflow . transforms . timeutil import Duration <EOL> from google . cloud . dataflow . transforms . timeutil import Timestamp <EOL> class TimestampTest ( unittest . TestCase ) : <EOL> def test_of ( self ) : <EOL> interval = Timestamp ( <NUM_LIT> ) <EOL> self . assertEqual ( id ( interval ) , id ( Timestamp . of ( interval ) ) ) <EOL> self . assertEqual ( interval , Timestamp . of ( <NUM_LIT> ) ) <EOL> with self . assertRaises ( TypeError ) : <EOL> Timestamp . of ( Duration ( <NUM_LIT:10> ) ) <EOL> def test_precision ( self ) : <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % <NUM_LIT:0.1> , <NUM_LIT:0> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % <NUM_LIT> , <NUM_LIT:0> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % <NUM_LIT> , <NUM_LIT:0> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % Duration ( <NUM_LIT:0.1> ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % Duration ( <NUM_LIT> ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % Duration ( <NUM_LIT> ) , <NUM_LIT:0> ) <EOL> def test_utc_timestamp ( self ) : <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) . isoformat ( ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) . isoformat ( ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) . isoformat ( ) , <EOL> '<STR_LIT>' ) <EOL> def test_arithmetic ( self ) : <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) + <NUM_LIT> , <NUM_LIT> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) + Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT> + Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) + Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) - <NUM_LIT> , - <NUM_LIT> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) - Duration ( <NUM_LIT> ) , - <NUM_LIT> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % <NUM_LIT> , <NUM_LIT> ) <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) % Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertTrue ( Duration ( <NUM_LIT> ) == Timestamp ( <NUM_LIT> ) ) <EOL> self . assertTrue ( Timestamp ( <NUM_LIT> ) == Duration ( <NUM_LIT> ) ) <EOL> self . assertFalse ( Duration ( <NUM_LIT> ) == Timestamp ( <NUM_LIT> ) ) <EOL> self . assertFalse ( Timestamp ( <NUM_LIT> ) == Duration ( <NUM_LIT> ) ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) + <NUM_LIT> ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) + Duration ( <NUM_LIT> ) ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( <NUM_LIT> + Timestamp ( <NUM_LIT> ) ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( Duration ( <NUM_LIT> ) + Timestamp ( <NUM_LIT> ) ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) - <NUM_LIT> ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) - Duration ( <NUM_LIT> ) ) . __class__ , Timestamp ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) % <NUM_LIT> ) . __class__ , Duration ) <EOL> self . assertEqual ( ( Timestamp ( <NUM_LIT> ) % Duration ( <NUM_LIT> ) ) . __class__ , Duration ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) * <NUM_LIT> , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( Timestamp ( <NUM_LIT> ) * Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( <NUM_LIT> * Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) * Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( <NUM_LIT> - Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) - Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( - Timestamp ( <NUM_LIT> ) , - <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( - Timestamp ( <NUM_LIT> ) , - Duration ( <NUM_LIT> ) ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( <NUM_LIT> % Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> with self . assertRaises ( TypeError ) : <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) % Timestamp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> def test_sort_order ( self ) : <EOL> self . assertEqual ( <EOL> [ - <NUM_LIT> , Timestamp ( - <NUM_LIT:3> ) , <NUM_LIT:2> , <NUM_LIT:9> , Timestamp ( <NUM_LIT> ) , <NUM_LIT> ] , <EOL> sorted ( [ <NUM_LIT:9> , <NUM_LIT:2> , Timestamp ( - <NUM_LIT:3> ) , Timestamp ( <NUM_LIT> ) , - <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> self . assertEqual ( <EOL> [ <NUM_LIT:4> , <NUM_LIT:5> , Timestamp ( <NUM_LIT:6> ) , Timestamp ( <NUM_LIT:7> ) , <NUM_LIT:8> , <NUM_LIT:9> ] , <EOL> sorted ( [ <NUM_LIT:9> , <NUM_LIT:8> , Timestamp ( <NUM_LIT:7> ) , Timestamp ( <NUM_LIT:6> ) , <NUM_LIT:5> , <NUM_LIT:4> ] ) ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Timestamp ( <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Timestamp ( - <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Timestamp ( - <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Timestamp ( <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Timestamp ( - <NUM_LIT> ) ) ) <EOL> class DurationTest ( unittest . TestCase ) : <EOL> def test_of ( self ) : <EOL> interval = Duration ( <NUM_LIT> ) <EOL> self . assertEqual ( id ( interval ) , id ( Duration . of ( interval ) ) ) <EOL> self . assertEqual ( interval , Duration . of ( <NUM_LIT> ) ) <EOL> with self . assertRaises ( TypeError ) : <EOL> Duration . of ( Timestamp ( <NUM_LIT:10> ) ) <EOL> def test_precision ( self ) : <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) % <NUM_LIT:0.1> , <NUM_LIT:0> ) <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) % <NUM_LIT> , <NUM_LIT:0> ) <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) % <NUM_LIT> , <NUM_LIT:0> ) <EOL> def test_arithmetic ( self ) : <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) + <NUM_LIT> , <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT> + Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) * <NUM_LIT> , <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT> * Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( Duration ( <NUM_LIT> ) - <NUM_LIT> , - <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT> - Duration ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( - Duration ( <NUM_LIT> ) , - <NUM_LIT> ) <EOL> def test_sort_order ( self ) : <EOL> self . assertEqual ( <EOL> [ - <NUM_LIT> , Duration ( - <NUM_LIT:3> ) , <NUM_LIT:2> , <NUM_LIT:9> , Duration ( <NUM_LIT> ) , <NUM_LIT> ] , <EOL> sorted ( [ <NUM_LIT:9> , <NUM_LIT:2> , Duration ( - <NUM_LIT:3> ) , Duration ( <NUM_LIT> ) , - <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> self . assertEqual ( <EOL> [ <NUM_LIT:4> , <NUM_LIT:5> , Duration ( <NUM_LIT:6> ) , Duration ( <NUM_LIT:7> ) , <NUM_LIT:8> , <NUM_LIT:9> ] , <EOL> sorted ( [ <NUM_LIT:9> , <NUM_LIT:8> , Duration ( <NUM_LIT:7> ) , Duration ( <NUM_LIT:6> ) , <NUM_LIT:5> , <NUM_LIT:4> ] ) ) <EOL> def test_str ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Duration ( <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Duration ( - <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Duration ( - <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Duration ( <NUM_LIT> ) ) ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> str ( Duration ( - <NUM_LIT> ) ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
