Beispiel #1
0
def test_angle_class_must_initialize_properly():
    a = Angle(sg="12h14m13.567s")
    val = 12 + 14 / 60.0 + 13.567 / 3600.0
    assert a.h == val
    assert a.ounit == 'hours'
    assert a.r == h2r(val)
    assert a.d == h2d(val)
    assert a.arcs == h2arcs(val)

    # ignore r
    with pytest.warns(UserWarning):
        Angle(sg="12h14m13.567s", r=10)

    a = Angle(sg="12h14m13.567s", r=10)
    assert a.r == h2r(val)
    assert a.ounit == 'hours'

    # ignore h and mm
    with pytest.warns(UserWarning):
        a = Angle(r=10, h=20)

    a = Angle(r=10, h=20)
    assert a.r == 10
    assert a.ounit == 'radians'
    assert a.h == r2h(10)

    a = Angle(h=20, d=10)
    assert a.d == 10
    assert a.ounit == 'degrees'
    assert a.h == d2h(10)
Beispiel #2
0
def test_angle_class_must_initialize_properly():
    a = Angle(sg="12h14m13.567s")
    val = 12 + 14/60.0 + 13.567 / 3600.0
    assert a.h == val
    assert a.ounit == 'hours'
    assert a.r == h2r(val)
    assert a.d == h2d(val)
    assert a.arcs == h2arcs(val)

    # ignore r
    with pytest.warns(UserWarning):
        Angle(sg="12h14m13.567s", r=10)

    a = Angle(sg="12h14m13.567s", r=10)
    assert a.r == h2r(val)
    assert a.ounit == 'hours'

    # ignore h and mm
    with pytest.warns(UserWarning):
        a = Angle(r=10, h=20)

    a = Angle(r=10, h=20)
    assert a.r == 10
    assert a.ounit == 'radians'
    assert a.h == r2h(10)

    a = Angle(h=20, d=10)
    assert a.d == 10
    assert a.ounit == 'degrees'
    assert a.h == d2h(10)
Beispiel #3
0
 def ra_hrs(self):
     return angles.r2h(self.obs.ra)
 def ra_hrs(self):
     return angles.r2h(self.obsdoc.ra)