def test_footprint_to_file(tmpdir):
 w = wcs.WCS({u'CTYPE1': u'RA---ZPN', u'CRUNIT1': u'deg', u'CRPIX1': (-334.95999), u'CRVAL1': 318.57907, u'CTYPE2': u'DEC--ZPN', u'CRUNIT2': u'deg', u'CRPIX2': 3045.3999, u'CRVAL2': 43.88538, u'PV2_1': 1.0, u'PV2_3': 220.0})
 testfile = str(tmpdir.join(u'test.txt'))
 w.footprint_to_file(testfile)
 with open(testfile, u'r') as f:
  lines = f.readlines()
 assert (len(lines) == 4)
 assert (lines[2] == u'ICRS\n')
 assert (u'color=green' in lines[3])
 w.footprint_to_file(testfile, coordsys=u'FK5', color=u'red')
 with open(testfile, u'r') as f:
  lines = f.readlines()
 assert (len(lines) == 4)
 assert (lines[2] == u'FK5\n')
 assert (u'color=red' in lines[3])
 with pytest.raises(ValueError):
  w.footprint_to_file(testfile, coordsys=u'FOO')

def test_footprint_to_file ( tmpdir ) : w = wcs . WCS ( { u'CTYPE1' : u'RA---ZPN' , u'CRUNIT1' : u'deg' , u'CRPIX1' : ( - 334.95999 ) , u'CRVAL1' : 318.57907 , u'CTYPE2' : u'DEC--ZPN' , u'CRUNIT2' : u'deg' , u'CRPIX2' : 3045.3999 , u'CRVAL2' : 43.88538 , u'PV2_1' : 1.0 , u'PV2_3' : 220.0 } ) testfile = str ( tmpdir . join ( u'test.txt' ) ) w . footprint_to_file ( testfile ) with open ( testfile , u'r' ) as f : lines = f . readlines ( ) assert ( len ( lines ) == 4 ) assert ( lines [ 2 ] == u'ICRS\n' ) assert ( u'color=green' in lines [ 3 ] ) w . footprint_to_file ( testfile , coordsys = u'FK5' , color = u'red' ) with open ( testfile , u'r' ) as f : lines = f . readlines ( ) assert ( len ( lines ) == 4 ) assert ( lines [ 2 ] == u'FK5\n' ) assert ( u'color=red' in lines [ 3 ] ) with pytest . raises ( ValueError ) : w . footprint_to_file ( testfile , coordsys = u'FOO' )
from github issue #1912 .