mirror of
https://github.com/django/django.git
synced 2025-01-18 14:24:39 +00:00
Refs #34983 -- Removed django.utils.itercompat per deprecation timeline.
This commit is contained in:
parent
6c120508b6
commit
f3a2509a54
@ -1,21 +0,0 @@
|
||||
# RemovedInDjango60Warning: Remove this entire module.
|
||||
|
||||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango60Warning
|
||||
|
||||
|
||||
def is_iterable(x):
|
||||
"An implementation independent way of checking for iterables"
|
||||
warnings.warn(
|
||||
"django.utils.itercompat.is_iterable() is deprecated. "
|
||||
"Use isinstance(..., collections.abc.Iterable) instead.",
|
||||
RemovedInDjango60Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
try:
|
||||
iter(x)
|
||||
except TypeError:
|
||||
return False
|
||||
else:
|
||||
return True
|
@ -302,3 +302,6 @@ to remove usage of these features.
|
||||
|
||||
* The ``ModelAdmin.log_deletion()`` and ``LogEntryManager.log_action()``
|
||||
methods are removed.
|
||||
|
||||
* The undocumented ``django.utils.itercompat.is_iterable()`` function and the
|
||||
``django.utils.itercompat`` module is removed.
|
||||
|
@ -1,16 +0,0 @@
|
||||
# RemovedInDjango60Warning: Remove this entire module.
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango60Warning
|
||||
from django.utils.itercompat import is_iterable
|
||||
|
||||
|
||||
class TestIterCompat(SimpleTestCase):
|
||||
def test_is_iterable_deprecation(self):
|
||||
msg = (
|
||||
"django.utils.itercompat.is_iterable() is deprecated. "
|
||||
"Use isinstance(..., collections.abc.Iterable) instead."
|
||||
)
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
is_iterable([])
|
||||
self.assertEqual(ctx.filename, __file__)
|
Loading…
x
Reference in New Issue
Block a user