mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #25190 -- Removed callable_obj parameter to assertRaisesMessages().
Per deprecation timeline.
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib.staticfiles.finders import get_finder, get_finders
|
||||
@@ -14,8 +13,7 @@ from django.forms import EmailField, IntegerField
|
||||
from django.http import HttpResponse
|
||||
from django.template.loader import render_to_string
|
||||
from django.test import (
|
||||
SimpleTestCase, TestCase, ignore_warnings, skipIfDBFeature,
|
||||
skipUnlessDBFeature,
|
||||
SimpleTestCase, TestCase, skipIfDBFeature, skipUnlessDBFeature,
|
||||
)
|
||||
from django.test.html import HTMLParseError, parse_html
|
||||
from django.test.utils import (
|
||||
@@ -25,7 +23,6 @@ from django.test.utils import (
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils import six
|
||||
from django.utils._os import abspathu
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .models import Car, Person, PossessedCar
|
||||
from .views import empty_response
|
||||
@@ -831,23 +828,6 @@ class AssertRaisesMsgTest(SimpleTestCase):
|
||||
with self.assertRaisesMessage(ValueError, "[.*x+]y?"):
|
||||
func1()
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_callable_obj_param(self):
|
||||
# callable_obj was a documented kwarg in Django 1.8 and older.
|
||||
def func1():
|
||||
raise ValueError("[.*x+]y?")
|
||||
|
||||
with warnings.catch_warnings(record=True) as warns:
|
||||
warnings.simplefilter('always')
|
||||
self.assertRaisesMessage(ValueError, "[.*x+]y?", callable_obj=func1)
|
||||
|
||||
self.assertEqual(len(warns), 1)
|
||||
self.assertEqual(
|
||||
str(warns[0].message),
|
||||
'The callable_obj kwarg is deprecated. Pass the callable '
|
||||
'as a positional argument instead.'
|
||||
)
|
||||
|
||||
|
||||
class AssertFieldOutputTests(SimpleTestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user