<s> from django . forms import CheckboxInput <EOL> from . base import WidgetTest <EOL> class CheckboxInputTest ( WidgetTest ) : <EOL> widget = CheckboxInput ( ) <EOL> def test_render_empty ( self ) : <EOL> self . check_html ( self . widget , '<STR_LIT>' , '<STR_LIT>' , html = '<STR_LIT>' ) <EOL> def test_render_none ( self ) : <EOL> self . check_html ( self . widget , '<STR_LIT>' , None , html = '<STR_LIT>' ) <EOL> def test_render_false ( self ) : <EOL> self . check_html ( self . widget , '<STR_LIT>' , False , html = '<STR_LIT>' ) <EOL> def test_render_true ( self ) : <EOL> self . check_html ( <EOL> self . widget , '<STR_LIT>' , True , <EOL> html = '<STR_LIT>' <EOL> ) <EOL> def test_render_value ( self ) : <EOL> """<STR_LIT>""" <EOL> self . check_html ( <EOL> self . widget , '<STR_LIT>' , '<STR_LIT:foo>' , <EOL> html = '<STR_LIT>' , <EOL> ) <EOL> def test_render_int ( self ) : <EOL> """<STR_LIT>""" <EOL> self . check_html ( <EOL> self . widget , '<STR_LIT>' , <NUM_LIT:0> , <EOL> html = '<STR_LIT>' , <EOL> ) <EOL> self . check_html ( <EOL> self . widget , '<STR_LIT>' , <NUM_LIT:1> , <EOL> html = '<STR_LIT>' , <EOL> ) <EOL> def test_render_check_test ( self ) : <EOL> """<STR_LIT>""" <EOL> widget = CheckboxInput ( check_test = lambda value : value . startswith ( '<STR_LIT:hello>' ) ) <EOL> self . check_html ( widget , '<STR_LIT>' , '<STR_LIT>' , html = ( <EOL> '<STR_LIT>' <EOL> ) ) <EOL> self . check_html ( widget , '<STR_LIT>' , '<STR_LIT:hello>' , html = ( <EOL> '<STR_LIT>' <EOL> ) ) <EOL> self . check_html ( widget , '<STR_LIT>' , '<STR_LIT>' , html = ( <EOL> '<STR_LIT>' <EOL> ) ) <EOL> self . check_html ( widget , '<STR_LIT>' , '<STR_LIT>' , html = ( <EOL> '<STR_LIT>' <EOL> ) ) <EOL> def test_render_check_exception ( self ) : <EOL> """<STR_LIT>""" <EOL> widget = CheckboxInput ( <EOL> check_test = lambda value : value . startswith ( '<STR_LIT:hello>' ) , <EOL> ) <EOL> with self . assertRaises ( AttributeError ) : <EOL> widget . render ( '<STR_LIT>' , True ) <EOL> def test_value_from_datadict ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertFalse ( self . widget . value_from_datadict ( { } , { } , '<STR_LIT>' ) ) <EOL> def test_value_from_datadict_string_int ( self ) : <EOL> value = self . widget . value_from_datadict ( { '<STR_LIT>' : '<STR_LIT:0>' } , { } , '<STR_LIT>' ) <EOL> self . assertEqual ( value , True ) </s>
