diff options
| author | Alex Gaynor <alex.gaynor@rd.io> | 2012-09-07 14:37:21 -0400 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@rd.io> | 2012-09-07 14:37:21 -0400 |
| commit | 6a5a12ea3e3193b3658b9237b86d98bc37d668d7 (patch) | |
| tree | 15eddff4e8f7787f71759a0fc3c7c54bf6048c70 /tests | |
| parent | e4ea53677449cfc56a0093bfbd92cb482020bb1e (diff) | |
Fixed #17888 -- no longer silence exceptions inside of check_test. Thanks to brutasse for the patch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/forms/tests/widgets.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/regressiontests/forms/tests/widgets.py b/tests/regressiontests/forms/tests/widgets.py index c950aef719..544ca41642 100644 --- a/tests/regressiontests/forms/tests/widgets.py +++ b/tests/regressiontests/forms/tests/widgets.py @@ -216,13 +216,9 @@ class FormsWidgetTestCase(TestCase): self.assertHTMLEqual(w.render('greeting', 'hello there'), '<input checked="checked" type="checkbox" name="greeting" value="hello there" />') self.assertHTMLEqual(w.render('greeting', 'hello & goodbye'), '<input checked="checked" type="checkbox" name="greeting" value="hello & goodbye" />') - # A subtlety: If the 'check_test' argument cannot handle a value and raises any - # exception during its __call__, then the exception will be swallowed and the box - # will not be checked. In this example, the 'check_test' assumes the value has a - # startswith() method, which fails for the values True, False and None. - self.assertHTMLEqual(w.render('greeting', True), '<input type="checkbox" name="greeting" />') - self.assertHTMLEqual(w.render('greeting', False), '<input type="checkbox" name="greeting" />') - self.assertHTMLEqual(w.render('greeting', None), '<input type="checkbox" name="greeting" />') + # Ticket #17888: calling check_test shouldn't swallow exceptions + with self.assertRaises(AttributeError): + w.render('greeting', True) # The CheckboxInput widget will return False if the key is not found in the data # dictionary (because HTML form submission doesn't send any result for unchecked |
