diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2013-05-21 10:42:15 +0100 |
|---|---|---|
| committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2013-05-21 10:42:15 +0100 |
| commit | 09f865276554f35060ff939722ec4cefd578edf6 (patch) | |
| tree | 39afbc8547b1e05cf58855369dbb4647fb642c84 /tests/forms_tests | |
| parent | 18856f866cc0e1cc703ae3f4c84b3c25a847b370 (diff) | |
Use assertIsInstance in tests.
Gives much nicer errors when it fails.
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/tests/test_formsets.py | 2 | ||||
| -rw-r--r-- | tests/forms_tests/tests/tests.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 787f177677..767a900673 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -982,7 +982,7 @@ class FormsFormsetTestCase(TestCase): ChoiceFormSet = formset_factory(Choice, formset=BaseCustomFormSet) formset = ChoiceFormSet(data, auto_id=False, prefix='choices') - self.assertTrue(isinstance(formset.non_form_errors(), ErrorList)) + self.assertIsInstance(formset.non_form_errors(), ErrorList) self.assertEqual(list(formset.non_form_errors()), ['This is a non-form error']) diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index deda4822b8..847cd6ebdb 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -52,9 +52,9 @@ class TestTicket14567(TestCase): form = OptionalMultiChoiceModelForm({'multi_choice_optional': '', 'multi_choice': [option.pk]}) self.assertTrue(form.is_valid()) # Check that the empty value is a QuerySet - self.assertTrue(isinstance(form.cleaned_data['multi_choice_optional'], models.query.QuerySet)) + self.assertIsInstance(form.cleaned_data['multi_choice_optional'], models.query.QuerySet) # While we're at it, test whether a QuerySet is returned if there *is* a value. - self.assertTrue(isinstance(form.cleaned_data['multi_choice'], models.query.QuerySet)) + self.assertIsInstance(form.cleaned_data['multi_choice'], models.query.QuerySet) class ModelFormCallableModelDefault(TestCase): |
