def test_component_error_useful():
 from ..builtin_frames import ICRS
 i = ICRS()
 with pytest.raises(ValueError) as excinfo:
  i.ra
 assert (u'does not have associated data' in str(excinfo.value))
 with pytest.raises(AttributeError) as excinfo1:
  i.foobar
 with pytest.raises(AttributeError) as excinfo2:
  i.lon
 assert (u"object has no attribute 'foobar'" in str(excinfo1.value))
 assert (u"object has no attribute 'lon'" in str(excinfo2.value))

def test_component_error_useful ( ) : from . . builtin_frames import ICRS i = ICRS ( ) with pytest . raises ( ValueError ) as excinfo : i . ra assert ( u'does not have associated data' in str ( excinfo . value ) ) with pytest . raises ( AttributeError ) as excinfo1 : i . foobar with pytest . raises ( AttributeError ) as excinfo2 : i . lon assert ( u"object has no attribute 'foobar'" in str ( excinfo1 . value ) ) assert ( u"object has no attribute 'lon'" in str ( excinfo2 . value ) )
check that a data-less frame gives useful error messages about not having data when the attributes asked for are possible coordinate components .