@pytest.mark.skipif(str(u'not HAS_SCIPY'))
def test_distances_scipy():
 from ...cosmology import WMAP5
 d4 = Distance(z=0.23)
 npt.assert_allclose(d4.z, 0.23, rtol=1e-08)
 d5 = Distance(z=0.23, cosmology=WMAP5)
 npt.assert_allclose(d5.compute_z(WMAP5), 0.23, rtol=1e-08)
 d6 = Distance(z=0.23, cosmology=WMAP5, unit=u.km)
 npt.assert_allclose(d6.value, 3.5417046898762366e+22)

@ pytest . mark . skipif ( str ( u'not HAS_SCIPY' ) ) def test_distances_scipy ( ) : from ... cosmology import WMAP5 d4 = Distance ( z = 0.23 ) npt . assert_allclose ( d4 . z , 0.23 , rtol = 1e-08 ) d5 = Distance ( z = 0.23 , cosmology = WMAP5 ) npt . assert_allclose ( d5 . compute_z ( WMAP5 ) , 0.23 , rtol = 1e-08 ) d6 = Distance ( z = 0.23 , cosmology = WMAP5 , unit = u . km ) npt . assert_allclose ( d6 . value , 3.5417046898762366e+22 )
the distance-related tests that require scipy due to the cosmology module needing scipy integration routines .