Пример #1
0
def test_angle_class_hms_and_dms_must_be_consistent():
    a = Angle(d=1)

    a.dms = (1, 1, 0, 0)
    assert a.hms.hms == (1, 0, 4, 0.0)

    a.hms = (1, 1, 0, 0)
    assert a.dms.dms == (1, 15, 0, 0.0)
Пример #2
0
def test_angle_class_hms_and_dms_must_be_consistent():
    a = Angle(d=1)

    a.dms = (1, 1, 0, 0)
    assert a.hms.hms == (1, 0, 4, 0.0)

    a.hms = (1, 1, 0, 0)
    assert a.dms.dms == (1, 15, 0, 0.0)
Пример #3
0
def test_angle_class_setting_hms_property_must_work():
    a = Angle(d=0.0)

    a.hms = (1, 12, 14, 13.567)
    v = 12 + 14 / 60.0 + 13.567 / 3600.0
    assert a.h == v
    assert a.hms.sign == 1
    assert a.hms.hh == 12
    assert a.hms.mm == 14
    assert a.hms.ss == 13.567
    assert str(a.hms) == "+12HH 14MM 13.567SS"

    a.hms.hh = 15
    assert a.h == 15 + 14 / 60.0 + 13.567 / 3600.0

    a.hms.mm = 15
    assert a.h == 15 + 15 / 60.0 + 13.567 / 3600.0

    a = Angle(d=0.0)
    a.hms.mm = 12
    assert round(a.h, 15) == 12 / 60.0
Пример #4
0
def test_angle_class_setting_hms_property_must_work():
    a = Angle(d=0.0)

    a.hms = (1, 12, 14, 13.567)
    v = 12 + 14/60.0 + 13.567/3600.0
    assert a.h == v
    assert a.hms.sign == 1
    assert a.hms.hh == 12
    assert a.hms.mm == 14
    assert a.hms.ss == 13.567
    assert str(a.hms) == "+12HH 14MM 13.567SS"

    a.hms.hh = 15
    assert a.h == 15 + 14/60.0 + 13.567/3600.0

    a.hms.mm = 15
    assert a.h == 15 + 15/60.0 + 13.567/3600.0

    a = Angle(d=0.0)
    a.hms.mm = 12
    assert round(a.h, 15) == 12/60.0