Skip to content

Test failure with hypothesis 4.42.0 #135

@astrofrog

Description

@astrofrog

A new test failure has appeared with hypothesis 4.42.0:

_____________________________________________________________ test_vec2ang _____________________________________________________________

    @given(vectors=arrays(float, (3,), elements=floats(-1, 1)).filter(not_at_origin),
>          lonlat=booleans(), ndim=integers(0, 4))
    @settings(max_examples=500, derandomize=True)
    def test_vec2ang(vectors, lonlat, ndim):

astropy_healpix/tests/test_healpy.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

vectors = array([ -0.00000000e+00,  -0.00000000e+00,   2.22044605e-16]), lonlat = False, ndim = 0

    @given(vectors=arrays(float, (3,), elements=floats(-1, 1)).filter(not_at_origin),
           lonlat=booleans(), ndim=integers(0, 4))
    @settings(max_examples=500, derandomize=True)
    def test_vec2ang(vectors, lonlat, ndim):
        vectors = np.broadcast_to(vectors, (2,) * ndim + (3,))
        theta1, phi1 = hp_compat.vec2ang(vectors, lonlat=lonlat)
        theta2, phi2 = hp.vec2ang(vectors, lonlat=lonlat)
        # Healpy sometimes returns NaNs for phi (somewhat incorrectly)
        phi2 = np.nan_to_num(phi2)
        assert_allclose(theta1, theta1, atol=1e-10)
>       assert_allclose(phi1, phi2, atol=1e-10)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=1e-10
E       
E       Mismatch: 100%
E       Max absolute difference: 3.141592653589793
E       Max relative difference: 1.0
E        x: array([ 0.])
E        y: array([ 3.141593])

astropy_healpix/tests/test_healpy.py:218: AssertionError
-------------------------------------------------------------- Hypothesis -----------------------------------------------------

I think this is a real failing test case rather than a hypothesis issue. Maybe we shouldn't be comparing phi values for theta=0 or theta=pi?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions