#NEWLINE# def _test( argv ) : #NEWLINE# #INDENT# from pycopia import autodebug #NEWLINE# metadata = DataFileData ( ) #NEWLINE# metadata . name = 'test_datafile' #NEWLINE# metadata . set_timestamp ( ) #NEWLINE# metadata [ 'state' ] = ON #NEWLINE# metadata [ 'voltage' ] = 2.5 #NEWLINE# fname = metadata . get_filename ( '/tmp' ) #NEWLINE# print ( 'filename: ' , fname ) #NEWLINE# fo = open ( fname , 'w' ) #NEWLINE# fo . write ( 'some data.\n' ) #NEWLINE# fo . close ( ) #NEWLINE# newmeta = decode_filename ( metadata ) #NEWLINE# print ( newmeta ) #NEWLINE# print ( newmeta [ 'voltage' ] ) #NEWLINE# with open ( fname ) as fo : #NEWLINE# #INDENT# fo . read ( ) #NEWLINE# #UNINDENT# assert ( metadata . voltage == newmeta . voltage ) #NEWLINE# assert ( newmeta . state == ON ) #NEWLINE# return ( metadata , newmeta )