@pytest.mark.skipif('not HAS_YAML')
def test_write_full():
 t = T_DTYPES[('bool', 'int64', 'float64', 'str')]
 lines = ['# %ECSV 0.9', '# ---', '# datatype:', '# - name: bool', '#   unit: m / s', '#   datatype: bool', '#   description: descr_bool', '#   meta: {meta bool: 1}', '# - name: int64', '#   unit: m / s', '#   datatype: int64', '#   description: descr_int64', '#   meta: {meta int64: 1}', '# - name: float64', '#   unit: m / s', '#   datatype: float64', '#   description: descr_float64', '#   meta: {meta float64: 1}', '# - name: str', '#   unit: m / s', '#   datatype: string', '#   description: descr_str', '#   meta: {meta str: 1}', '# meta: !!omap', '# - comments: [comment1, comment2]', 'bool int64 float64 str', 'False 0 0.0 "ab 0"', 'True 1 1.0 "ab, 1"', 'False 2 2.0 ab2']
 out = StringIO()
 t.write(out, format='ascii.ecsv')
 assert (out.getvalue().splitlines() == lines)

@ pytest . mark . skipif ( 'not HAS_YAML' ) def test_write_full ( ) : t = T_DTYPES [ ( 'bool' , 'int64' , 'float64' , 'str' ) ] lines = [ '# %ECSV 0.9' , '# ---' , '# datatype:' , '# - name: bool' , '#   unit: m / s' , '#   datatype: bool' , '#   description: descr_bool' , '#   meta: {meta bool: 1}' , '# - name: int64' , '#   unit: m / s' , '#   datatype: int64' , '#   description: descr_int64' , '#   meta: {meta int64: 1}' , '# - name: float64' , '#   unit: m / s' , '#   datatype: float64' , '#   description: descr_float64' , '#   meta: {meta float64: 1}' , '# - name: str' , '#   unit: m / s' , '#   datatype: string' , '#   description: descr_str' , '#   meta: {meta str: 1}' , '# meta: !!omap' , '# - comments: [comment1, comment2]' , 'bool int64 float64 str' , 'False 0 0.0 "ab 0"' , 'True 1 1.0 "ab, 1"' , 'False 2 2.0 ab2' ] out = StringIO ( ) t . write ( out , format = 'ascii.ecsv' ) assert ( out . getvalue ( ) . splitlines ( ) == lines )
write a full-featured table with common types and explicitly checkout output .