from astropy.table import Table
from astropy.coordinates import ICRS, name_resolve
from astropy import units as u

TABLE_NAME = 'feder_object_list.csv'
MAX_SEP = 5  # arcsec

# increase timeout so that the Travis builds succeed
name_resolve.NAME_RESOLVE_TIMEOUT.set(30)


def test_table_can_be_read_and_coords_good():
    objs = Table.read(TABLE_NAME, format='ascii', delimiter=',')
    columns = ['object', 'ra', 'dec']
    for col in columns:
        assert col in objs.colnames
    for row in objs:
        try:
            simbad_pos = ICRS.from_name(row['object'])
        except name_resolve.NameResolveError:
            continue
        table_pos = ICRS(row['ra'], row['dec'], unit=(u.hour, u.degree))
        # CHANGE ASSERT TO IF/THEN, print name then assert 0
        sep = table_pos.separation(simbad_pos).arcsec
        warn = ''
        if sep > MAX_SEP:
            warn = ('Bad RA/Dec for object {}, '
                    'separation is {} arcsec'.format(row['object'], sep))
            print (warn)
        assert len(warn) == 0

@@ -2,272 +2,992 @@
 rom 
-astropy.table import Table%0Afrom astropy.coordinates import ICRS, name_resolve%0Afrom astropy import units as u%0A%0ATABLE_NAME = 'feder_object_list.csv'%0AMAX_SEP = 5  # arcsec%0A%0A# increase timeout so that the Travis builds succeed%0Aname_resolve.NAME_RESOLVE_TIMEOUT.set(30)
+__future__ import print_function, division%0A%0Afrom exceptions import Exception%0A%0Afrom astropy.table import Table%0Afrom astropy.coordinates import SkyCoord%0Afrom astropy.coordinates.name_resolve import NameResolveError%0Afrom astropy import units as u%0Afrom astropy import utils%0A%0A%0Aclass CoordinateMismatchError(Exception):%0A    pass%0A%0ATABLE_NAME = 'feder_object_list.csv'%0AMAX_SEP = 5  # arcsec%0A%0A# increase timeout so that the Travis builds succeed%0Autils.data.conf.remote_timeout = 30%0A%0A# Failures that are allowed to occur because they have been hand verified.%0A# Add the name of the object as the key and the expected error as the value.%0A# Also add a reference for the coordinates or a brief explanation.%0AALLOWED_FAILURES = %7B%0A    'nsv 4863': NameResolveError, # in VSX https://www.aavso.org/vsx/index.php?view=detail.top&revid=208743%0A    'sa111': NameResolveError, # Found in simbad, but no coordinates%0A    'sa104': CoordinateMismatchError, # Field is wide, our center differs by several arcmin%0A%7D
 %0A%0A%0Ad
@@ -1193,16 +1193,35 @@
 colnames
+%0A%0A    failures = %7B%7D
 %0A    for
@@ -1234,16 +1234,52 @@
 n objs:%0A
+        object_name = row%5B'object'%5D%0A
         
@@ -1308,20 +1308,24 @@
 d_pos = 
-ICRS
+SkyCoord
 .from_na
@@ -1327,29 +1327,27 @@
 om_name(
-row%5B'
 object
-'%5D
+_name
 )%0A      
@@ -1359,21 +1359,62 @@
 ept 
-name_r
+NameR
 esolve
-.
+Error:%0A            failures%5Bobject_name%5D = 
 Name
@@ -1417,33 +1417,32 @@
 NameResolveError
-:
 %0A            con
@@ -1447,16 +1447,17 @@
 ontinue%0A
+%0A
         
@@ -1472,12 +1472,16 @@
 s = 
-ICRS
+SkyCoord
 (row
@@ -1790,29 +1790,27 @@
 mat(
-row%5B'
 object
-'%5D
+_name
 , sep))%0A
     
@@ -1805,16 +1805,79 @@
 , sep))%0A
+            if object_name not in ALLOWED_FAILURES.keys():%0A    
         
@@ -1885,17 +1885,16 @@
    print
- 
 (warn)%0A 
@@ -1904,23 +1904,412 @@
     
-assert len(warn
+    failures%5Bobject_name%5D = CoordinateMismatchError%0A%0A    real_failures = %7B%7D%0A    for name, fail in failures.iteritems():%0A        try:%0A            assert ALLOWED_FAILURES%5Bname%5D == fail%0A        except (KeyError, AssertionError):%0A            # Either way, this was an unexpected failure.%0A            real_failures%5Bname%5D = fail%0A%0A    if real_failures:%0A        print(real_failures)%0A%0A    assert len(real_failures
 ) ==

Change coordinates to work with astropy >= 1