Пример #1
0
assert(t4struct.t == 1234.5)
t5 = LIGOTimeGPS("1000")
assert(t5 == 1000)
try:
    t5 = LIGOTimeGPS("abc1000")
    expected_exception = True
except:
    pass
assert(not expected_exception)
try:
    t5 = LIGOTimeGPS("1000abc")
    expected_exception = True
except:
    pass
assert(not expected_exception)
assert(lal.swig_lal_test_noptrgps(LIGOTimeGPS(1234.5)) == lal.swig_lal_test_noptrgps(1234.5))
del t0, t1, t2, t3, t4struct, t5
lal.CheckMemoryLeaks()
print("PASSED LIGOTimeGPS operations")

# check object parent tracking
print("checking object parent tracking ...")
a = lal.gsl_vector(3)
a.data = [1.1, 2.2, 3.3]
b = a.data
assert(not b.flags['OWNDATA'])
assert((b == [1.1, 2.2, 3.3]).all())
del a
assert((b == [1.1, 2.2, 3.3]).all())
ts = lal.CreateREAL8TimeSeries("test", lal.LIGOTimeGPS(0), 0, 0.1, lal.lalDimensionlessUnit, 10)
ts.data.data = range(0, 10)
Пример #2
0
assert (t5 == 1000)
print("*** below should be error messages from LIGOTimeGPS constructor ***")
try:
    t5 = LIGOTimeGPS("abc1000")
    expected_exception = True
except:
    pass
assert (not expected_exception)
try:
    t5 = LIGOTimeGPS("1000abc")
    expected_exception = True
except:
    pass
assert (not expected_exception)
print("*** above should be error messages from LIGOTimeGPS constructor ***")
assert (lal.swig_lal_test_noptrgps(
    LIGOTimeGPS(1234.5)) == lal.swig_lal_test_noptrgps(1234.5))
try:
    LIGOTimeGPS(None)
    expected_exception = True
except:
    pass
assert (not expected_exception)
del t0
del t1
del t2
del t3
del t4struct
del t5
lal.CheckMemoryLeaks()
print("PASSED LIGOTimeGPS operations")
print("checking LIGOTimeGPS operations (Python specific) ...")