#NEWLINE# def test_categorical_immutable( self ) : #NEWLINE# #INDENT# d = Data ( ) #NEWLINE# c = CategoricalComponent ( [ 'M' , 'M' , 'F' ] , categories = [ 'M' , 'F' ] ) #NEWLINE# d . add_component ( c , label = 'gender' ) #NEWLINE# with pytest . raises ( ValueError ) as exc : #NEWLINE# #INDENT# d [ 'gender' ] [ : ] = 5 #NEWLINE# #UNINDENT# assert ( 'read-only' in exc . value . args [ 0 ] ) #NEWLINE# assert ( not d [ 'gender' ] . flags [ 'WRITEABLE' ] )