class TestMultipleSelection: def setup(self): class FakeProvider(object): def get_dropdown_options(self, e, fn, dfn): return [('1', 'a'), ('2', 'b')] self.widget = PropertyMultipleSelectField( options=[('1', 'a'), ('2', 'b')], validator=_ListOrIntValidator(), item_validator=IntValidator(), provider=FakeProvider()) def test_multiple_selection_single_entry(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for Tw2') self.widget.req()._validate('1') == [1] def test_multiple_selection_invalid_entries(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for TW2') self.widget.req()._validate(['a', 'b']) == [] def test_multiple_selection_invalid_entries_display(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for TW2') res = self.widget.req().display(value=['1', 'b', 'c', 'd', 'e']) res.count('selected="selected"') == 1, res
class TestMultipleSelection: def setup(self): class FakeProvider(object): def get_dropdown_options(self, e, fn, dfn): return [('1', 'a'), ('2', 'b')] self.widget = PropertyMultipleSelectField(options=[('1', 'a'), ('2', 'b')], validator=_ListOrIntValidator(), item_validator=IntValidator(), provider=FakeProvider()) def test_multiple_selection_single_entry(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for Tw2') self.widget.req()._validate('1') == [1] def test_multiple_selection_invalid_entries(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for TW2') self.widget.req()._validate(['a', 'b']) == [] def test_multiple_selection_invalid_entries_display(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for TW2') res = self.widget.req().display(value=['1', 'b', 'c', 'd', 'e']) res.count('selected="selected"') == 1, res
def setup(self): class FakeProvider(object): def get_dropdown_options(self, e, fn, dfn): return [('1', 'a'), ('2', 'b')] self.widget = PropertyMultipleSelectField( options=[('1', 'a'), ('2', 'b')], validator=_ListOrIntValidator(), item_validator=IntValidator(), provider=FakeProvider())
class TestMultipleSelection: def setup(self): self.widget = PropertyMultipleSelectField(options=[('1', 'a'), ('2', 'b')], validator=IntValidator()) def test_multiple_selection_single_entry(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for Tw2') self.widget.req()._validate('1') == [1] def test_multiple_selection_invalid_entries(self): if not hasattr(self.widget, 'req'): raise SkipTest('Test for TW2') self.widget.req()._validate(['a', 'b']) == []
def setup(self): class FakeProvider(object): def get_dropdown_options(self, e, fn, dfn): return [('1', 'a'), ('2', 'b')] self.widget = PropertyMultipleSelectField(options=[('1', 'a'), ('2', 'b')], validator=_ListOrIntValidator(), item_validator=IntValidator(), provider=FakeProvider())
def setup(self): self.widget = PropertyMultipleSelectField(options=[('1', 'a'), ('2', 'b')], validator=IntValidator())