<s> '''<STR_LIT>''' <EOL> from pyon . util . unit_test import PyonTestCase <EOL> from pyon . util . ion_time import IonTime <EOL> from nose . plugins . attrib import attr <EOL> import time <EOL> import numpy as np <EOL> import datetime <EOL> @ attr ( '<STR_LIT>' ) <EOL> class IonTimeUnitTest ( PyonTestCase ) : <EOL> def test_time_ntp_fidelity ( self ) : <EOL> it1 = IonTime ( ) <EOL> ntp_ts = it1 . to_ntp64 ( ) <EOL> it2 = IonTime . from_ntp64 ( ntp_ts ) <EOL> self . assertEquals ( it1 . seconds , it2 . seconds ) <EOL> self . assertTrue ( np . abs ( it1 . useconds - it2 . useconds ) <= <NUM_LIT:1> ) <EOL> def test_time_string_fidelity ( self ) : <EOL> it1 = IonTime ( ) <EOL> ntp_str = it1 . to_string ( ) <EOL> it2 = IonTime . from_string ( ntp_str ) <EOL> self . assertEquals ( it1 . seconds , it2 . seconds ) <EOL> self . assertTrue ( np . abs ( it1 . useconds - it2 . useconds ) <= <NUM_LIT:1> ) <EOL> def test_unix_time_fidelity ( self ) : <EOL> ts = time . time ( ) <EOL> it1 = IonTime ( ts ) <EOL> ts_2 = it1 . to_unix ( ) <EOL> self . assertTrue ( np . abs ( ts - ts_2 ) <= <NUM_LIT> ) <EOL> def test_ntp_compatability ( self ) : <EOL> unix_day = IonTime ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> self . assertEquals ( unix_day . era , <NUM_LIT:0> ) <EOL> self . assertEquals ( unix_day . seconds , <NUM_LIT> ) <EOL> utc_day = IonTime ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> self . assertEquals ( utc_day . era , <NUM_LIT:0> ) <EOL> self . assertEquals ( utc_day . seconds , <NUM_LIT> ) <EOL> millen_day = IonTime ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> self . assertEquals ( millen_day . era , <NUM_LIT:0> ) <EOL> self . assertEquals ( millen_day . seconds , <NUM_LIT> ) <EOL> ntp_era1 = IonTime ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:8> ) ) <EOL> self . assertEquals ( ntp_era1 . era , <NUM_LIT:1> ) <EOL> self . assertEquals ( ntp_era1 . seconds , <NUM_LIT> ) <EOL> self . assertEquals ( ntp_era1 . to_unix ( ) , <NUM_LIT> ) </s>
