import datetime from django.forms import MultiWidget, RadioSelect from django.test import override_settings from .base import WidgetTest class RadioSelectTest(WidgetTest): widget = RadioSelect def test_render(self): choices = (('', '------'),) + self.beatles self.check_html(self.widget(choices=choices), 'beatle', 'J', html=( """""" )) def test_nested_choices(self): nested_choices = ( ('unknown', 'Unknown'), ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))), ('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))), ) html = """ """ self.check_html( self.widget(choices=nested_choices), 'nestchoice', 'dvd', attrs={'id': 'media'}, html=html, ) def test_constructor_attrs(self): """ Attributes provided at instantiation are passed to the constituent inputs. """ widget = RadioSelect(attrs={'id': 'foo'}, choices=self.beatles) html = """ """ self.check_html(widget, 'beatle', 'J', html=html) def test_render_attrs(self): """ Attributes provided at render-time are passed to the constituent inputs. """ html = """ """ self.check_html(self.widget(choices=self.beatles), 'beatle', 'J', attrs={'id': 'bar'}, html=html) def test_class_attrs(self): """ The