Exemplo n.º 1
0
def test_projection_factors_incorrect():
    """Test the projection factor functions with incorrect inputs."""
    with pytest.raises(Exception):
        get_projection_factor(25, 0, 'Standing')  # incorrect capitalization
    with pytest.raises(Exception):
        get_projection_factor(100, 0, 'standing')  # incorrect altitude
    with pytest.raises(Exception):
        get_projection_factor_simple(25, 0,
                                     'Standing')  # incorrect capitalization
    with pytest.raises(Exception):
        get_projection_factor_simple(100, 0, 'standing')  # incorrect altitude
Exemplo n.º 2
0
def test_projection_factors():
    """Test the projection factor functions against one another."""
    for posture in ('standing', 'seated', 'supine'):
        for alt in list(xrange(1, 90, 10)) + [90]:
            for sharp in xrange(0, 190, 10):
                pf1 = get_projection_factor(alt, sharp, posture)
                pf2 = get_projection_factor_simple(alt, sharp, posture)
                assert pf1 == pytest.approx(pf2, rel=0.1)