<s> from django . test import SimpleTestCase <EOL> from ralph . admin . widgets import PermissionsSelectWidget <EOL> class PerimissionsSelectWidgetTest ( SimpleTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ) . setUp ( ) <EOL> self . separator = '<STR_LIT>' <EOL> self . choices = ( <EOL> ( <NUM_LIT:1> , self . separator . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) , <EOL> ( <NUM_LIT:2> , self . separator . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) , <EOL> ( <NUM_LIT:3> , self . separator . join ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) , <EOL> ) <EOL> self . widget = PermissionsSelectWidget ( choices = self . choices ) <EOL> def test_render ( self ) : <EOL> """<STR_LIT>""" <EOL> rendered_widget = self . widget . render ( name = '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> for value , label in self . choices : <EOL> self . assertTrue ( label . split ( self . separator ) [ - <NUM_LIT:1> ] in rendered_widget ) <EOL> def test_render_selected_option ( self ) : <EOL> """<STR_LIT>""" <EOL> rendered_option = self . widget . render_option ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <NUM_LIT:1> , '<STR_LIT:test>' ) <EOL> self . assertTrue ( '<STR_LIT>' in rendered_option ) <EOL> def test_get_value_from_dict ( self ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> value = self . widget . value_from_datadict ( <EOL> data = { name : '<STR_LIT>' } , files = None , name = name <EOL> ) <EOL> self . assertEqual ( value , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) </s>
