diff options
| author | Morgan Aubert <morgan.aubert@impakfinance.com> | 2018-04-27 17:18:15 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-05-09 11:40:28 -0400 |
| commit | 704443acacf0dfbcb1c52df4b260585055754ce7 (patch) | |
| tree | 600147bf6114d7b490fcd253ff9797b7e7531c09 /tests/forms_tests | |
| parent | 7ba040de7703fd06b9b35ddd31da40103d911c30 (diff) | |
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/tests/test_media.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py index 9798fc027b..a586da90c5 100644 --- a/tests/forms_tests/tests/test_media.py +++ b/tests/forms_tests/tests/test_media.py @@ -1,5 +1,3 @@ -import warnings - from django.forms import CharField, Form, Media, MultiWidget, TextInput from django.template import Context, Template from django.test import SimpleTestCase, override_settings @@ -540,10 +538,6 @@ class FormsMediaTestCase(SimpleTestCase): self.assertEqual(Media.merge(list1, list2), expected) def test_merge_warning(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') + msg = 'Detected duplicate Media files in an opposite order:\n1\n2' + with self.assertWarnsMessage(RuntimeWarning, msg): self.assertEqual(Media.merge([1, 2], [2, 1]), [1, 2]) - self.assertEqual( - str(w[-1].message), - 'Detected duplicate Media files in an opposite order:\n1\n2' - ) |
