#NEWLINE# @ requires_astropy #NEWLINE# def test_make_data_file( ) : #NEWLINE# #INDENT# from astropy.table import Table #NEWLINE# d = Data ( x = [ 1 , 2 , 3 ] , y = [ 2 , 3 , 4 ] , label = 'data' ) #NEWLINE# s = d . new_subset ( label = 'test' ) #NEWLINE# s . subset_state = ( d . id [ 'x' ] > 1 ) #NEWLINE# dir = mkdtemp ( ) #NEWLINE# try : #NEWLINE# #INDENT# make_data_file ( d , ( s , ) , dir ) #NEWLINE# t = Table . read ( os . path . join ( dir , 'data.csv' ) , format = 'ascii' ) #NEWLINE# np . testing . assert_array_equal ( t [ 'x' ] , [ 1 , 2 , 3 ] ) #NEWLINE# np . testing . assert_array_equal ( t [ 'y' ] , [ 2 , 3 , 4 ] ) #NEWLINE# np . testing . assert_array_equal ( t [ 'selection_0' ] , [ 0 , 1 , 1 ] ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# rmtree ( dir , ignore_errors = True )