예제 #1
0
def test_epoch_isub():
    """Tests the accumulative subtraction in Epochs"""

    a = Epoch(2001, 12, 31.0)
    a -= 2*365
    y, m, d = a.get_date()
    assert y == 2000 and m == 1 and abs(round(d, 1) - 1.0) < TOL, \
        "ERROR: 1st __isub__() test, output doesn't match"
예제 #2
0
def test_epoch_iadd():
    """Tests the accumulative addition in Epochs"""

    a = Epoch(2003, 12, 31.0)
    a += 32.5
    y, m, d = a.get_date()
    assert y == 2004 and m == 2 and abs(round(d, 1) - 1.5) < TOL, \
        "ERROR: 1st __iadd__() test, output doesn't match"
예제 #3
0
def test_epoch_get_date():
    """Tests the get_date() method of Epoch class"""

    e = Epoch(2436116.31)
    t = e.get_date()
    assert t[0] == 1957 and t[1] == 10 and abs(t[2] - 4.81) < TOL, \
        "ERROR: 1st get_date() test, output doesn't match"

    e = Epoch(1842713.0)
    t = e.get_date()
    assert t[0] == 333 and t[1] == 1 and abs(t[2] - 27.5) < TOL, \
        "ERROR: 2nd get_date() test, output doesn't match"

    e = Epoch(1507900.13)
    t = e.get_date()
    assert t[0] == -584 and t[1] == 5 and abs(round(t[2], 2) - 28.63) < TOL, \
        "ERROR: 3rd get_date() test, output doesn't match"
예제 #4
0
def test_epoch_sub():
    """Tests the subtraction between Epochs"""

    a = Epoch(1986, 2, 9.0)
    b = Epoch(1910, 4, 20.0)
    c = a - b
    assert abs(round(c, 1) - 27689.0) < TOL, \
        "ERROR: 1st __sub__() test, output doesn't match"

    a = Epoch(2003, 12, 31.0)
    b = a - 365.5
    y, m, d = b.get_date()
    assert y == 2002 and m == 12 and abs(round(d, 1) - 30.5) < TOL, \
        "ERROR: 2nd __sub__() test, output doesn't match"