Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-django-filter for
openSUSE:Factory checked in at 2021-03-18 22:55:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-filter (Old)
and /work/SRC/openSUSE:Factory/.python-django-filter.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-filter"
Thu Mar 18 22:55:51 2021 rev:6 rq:879943 version:2.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-django-filter/python-django-filter.changes
2020-06-10 00:50:24.795258458 +0200
+++
/work/SRC/openSUSE:Factory/.python-django-filter.new.2401/python-django-filter.changes
2021-03-18 22:55:52.731591215 +0100
@@ -1,0 +2,9 @@
+Mon Mar 15 12:25:35 UTC 2021 - Mark??ta Machov?? <[email protected]>
+
+- update to 2.4.0
+ * Added a MaxValueValidator to the form field for NumberFilter.
+ This prevents a potential DoS attack if numbers with very large
+ exponents were subsequently converted to integers.
+ * Added testing against Django 3.1 and Python 3.9.
+
+-------------------------------------------------------------------
Old:
----
django-filter-2.3.0.tar.gz
New:
----
django-filter-2.4.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-django-filter.spec ++++++
--- /var/tmp/diff_new_pack.JDFEif/_old 2021-03-18 22:55:53.239591736 +0100
+++ /var/tmp/diff_new_pack.JDFEif/_new 2021-03-18 22:55:53.243591740 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-django-filter
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,21 +19,21 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-django-filter
-Version: 2.3.0
+Version: 2.4.0
Release: 0
Summary: Reusable Django app to allow users to filter queryset
dynamically
License: BSD-3-Clause
Group: Development/Libraries/Python
URL: https://github.com/carltongibson/django-filter
Source:
https://files.pythonhosted.org/packages/source/d/django-filter/django-filter-%{version}.tar.gz
-BuildRequires: %{python_module Django}
+BuildRequires: %{python_module Django >= 2.2}
BuildRequires: %{python_module django-crispy-forms}
BuildRequires: %{python_module djangorestframework}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-Django
+Requires: python-Django >= 2.2
Requires: python-djangorestframework
Recommends: python-django-crispy-forms
BuildArch: noarch
++++++ django-filter-2.3.0.tar.gz -> django-filter-2.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/CHANGES.rst
new/django-filter-2.4.0/CHANGES.rst
--- old/django-filter-2.3.0/CHANGES.rst 2020-06-05 16:37:06.000000000 +0200
+++ new/django-filter-2.4.0/CHANGES.rst 2020-09-27 10:57:44.000000000 +0200
@@ -1,3 +1,20 @@
+Version 2.4.0 (2020-9-27)
+--------------------------
+
+* SECURITY: Added a ``MaxValueValidator`` to the form field for
+ ``NumberFilter``. This prevents a potential DoS attack if numbers with very
+ large exponents were subsequently converted to integers.
+
+ The default limit value for the validator is ``1e50``.
+
+ The new ``NumberFilter.get_max_validator()`` allows customising the used
+ validator, and may return ``None`` to disable the validation entirely.
+
+* Added testing against Django 3.1 and Python 3.9.
+
+ In addition tests against Django main development branch are now required to
+ pass.
+
Version 2.3.0 (2020-6-5)
------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/PKG-INFO
new/django-filter-2.4.0/PKG-INFO
--- old/django-filter-2.3.0/PKG-INFO 2020-06-05 16:45:54.000000000 +0200
+++ new/django-filter-2.4.0/PKG-INFO 2020-09-27 11:08:50.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: django-filter
-Version: 2.3.0
+Version: 2.4.0
Summary: Django-filter is a reusable Django application for allowing users to
filter querysets dynamically.
Home-page: https://github.com/carltongibson/django-filter/tree/master
Author: Alex Gaynor
@@ -31,8 +31,8 @@
Requirements
------------
- * **Python**: 3.5, 3.6, 3.7, 3.8
- * **Django**: 2.2, 3.0
+ * **Python**: 3.5, 3.6, 3.7, 3.8, 3.9
+ * **Django**: 2.2, 3.0, 3.1
* **DRF**: 3.10+
From Version 2.0 Django Filter is Python 3 only.
@@ -126,11 +126,13 @@
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
+Classifier: Framework :: Django :: 3.1
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Framework :: Django
Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/README.rst
new/django-filter-2.4.0/README.rst
--- old/django-filter-2.3.0/README.rst 2020-05-14 14:31:54.000000000 +0200
+++ new/django-filter-2.4.0/README.rst 2020-09-26 19:13:46.000000000 +0200
@@ -21,8 +21,8 @@
Requirements
------------
-* **Python**: 3.5, 3.6, 3.7, 3.8
-* **Django**: 2.2, 3.0
+* **Python**: 3.5, 3.6, 3.7, 3.8, 3.9
+* **Django**: 2.2, 3.0, 3.1
* **DRF**: 3.10+
From Version 2.0 Django Filter is Python 3 only.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/django_filter.egg-info/PKG-INFO
new/django-filter-2.4.0/django_filter.egg-info/PKG-INFO
--- old/django-filter-2.3.0/django_filter.egg-info/PKG-INFO 2020-06-05
16:45:54.000000000 +0200
+++ new/django-filter-2.4.0/django_filter.egg-info/PKG-INFO 2020-09-27
11:08:49.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: django-filter
-Version: 2.3.0
+Version: 2.4.0
Summary: Django-filter is a reusable Django application for allowing users to
filter querysets dynamically.
Home-page: https://github.com/carltongibson/django-filter/tree/master
Author: Alex Gaynor
@@ -31,8 +31,8 @@
Requirements
------------
- * **Python**: 3.5, 3.6, 3.7, 3.8
- * **Django**: 2.2, 3.0
+ * **Python**: 3.5, 3.6, 3.7, 3.8, 3.9
+ * **Django**: 2.2, 3.0, 3.1
* **DRF**: 3.10+
From Version 2.0 Django Filter is Python 3 only.
@@ -126,11 +126,13 @@
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
+Classifier: Framework :: Django :: 3.1
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Framework :: Django
Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/django_filters/__init__.py
new/django-filter-2.4.0/django_filters/__init__.py
--- old/django-filter-2.3.0/django_filters/__init__.py 2020-06-05
16:37:10.000000000 +0200
+++ new/django-filter-2.4.0/django_filters/__init__.py 2020-09-27
10:57:29.000000000 +0200
@@ -10,7 +10,7 @@
from . import rest_framework
del pkgutil
-__version__ = '2.3.0'
+__version__ = '2.4.0'
def parse_version(version):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/django_filters/fields.py
new/django-filter-2.4.0/django_filters/fields.py
--- old/django-filter-2.3.0/django_filters/fields.py 2020-05-14
16:41:13.000000000 +0200
+++ new/django-filter-2.4.0/django_filters/fields.py 2020-09-26
19:13:46.000000000 +0200
@@ -224,10 +224,7 @@
yield ("", self.field.empty_label)
if self.field.null_label is not None:
yield (self.field.null_value, self.field.null_label)
-
- # Python 2 lacks 'yield from'
- for choice in self.choices:
- yield choice
+ yield from self.choices
def __len__(self):
add = 1 if self.field.empty_label is not None else 0
@@ -247,10 +244,7 @@
yield next(iterable)
if self.field.null_label is not None:
yield (self.field.null_value, self.field.null_label)
-
- # Python 2 lacks 'yield from'
- for value in iterable:
- yield value
+ yield from iterable
def __len__(self):
add = 1 if self.field.null_label is not None else 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/django_filters/filters.py
new/django-filter-2.4.0/django_filters/filters.py
--- old/django-filter-2.3.0/django_filters/filters.py 2020-05-14
16:43:55.000000000 +0200
+++ new/django-filter-2.4.0/django_filters/filters.py 2020-09-26
19:13:46.000000000 +0200
@@ -2,6 +2,7 @@
from datetime import timedelta
from django import forms
+from django.core.validators import MaxValueValidator
from django.db.models import Q
from django.db.models.constants import LOOKUP_SEP
from django.forms.utils import pretty_name
@@ -357,6 +358,23 @@
class NumberFilter(Filter):
field_class = forms.DecimalField
+ def get_max_validator(self):
+ """
+ Return a MaxValueValidator for the field, or None to disable.
+ """
+ return MaxValueValidator(1e50)
+
+ @property
+ def field(self):
+ if not hasattr(self, '_field'):
+ field = super().field
+ max_validator = self.get_max_validator()
+ if max_validator:
+ field.validators.append(max_validator)
+
+ self._field = field
+ return self._field
+
class NumericRangeFilter(Filter):
field_class = RangeField
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/django_filters/utils.py
new/django-filter-2.4.0/django_filters/utils.py
--- old/django-filter-2.3.0/django_filters/utils.py 2020-05-14
14:31:54.000000000 +0200
+++ new/django-filter-2.4.0/django_filters/utils.py 2020-09-26
19:13:46.000000000 +0200
@@ -309,7 +309,7 @@
"""
# it's necessary to lazily import the exception, as it can otherwise create
# an import loop when importing django_filters inside the project settings.
- from rest_framework.exceptions import ValidationError, ErrorDetail
+ from rest_framework.exceptions import ErrorDetail, ValidationError
exc = OrderedDict(
(key, [ErrorDetail(e.message % (e.params or ()), code=e.code)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/docs/conf.py
new/django-filter-2.4.0/docs/conf.py
--- old/django-filter-2.3.0/docs/conf.py 2020-06-05 16:35:23.000000000
+0200
+++ new/django-filter-2.4.0/docs/conf.py 2020-09-26 19:37:07.000000000
+0200
@@ -13,6 +13,8 @@
import sys, os
+from django_filters import __version__
+
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -41,16 +43,16 @@
# General information about the project.
project = u'django-filter'
-copyright = u'2019, Alex Gaynor, Carlton Gibson and others.'
+copyright = u'2020, Alex Gaynor, Carlton Gibson and others.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '2.3'
+version = __version__
# The full version, including alpha/beta/rc tags.
-release = '2.3.0'
+release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/docs/dev/tests.txt
new/django-filter-2.4.0/docs/dev/tests.txt
--- old/django-filter-2.3.0/docs/dev/tests.txt 2017-10-19 11:26:45.000000000
+0200
+++ new/django-filter-2.4.0/docs/dev/tests.txt 2020-09-26 19:13:46.000000000
+0200
@@ -81,7 +81,7 @@
# or
$ pip install isort
- $ isort --check-only --recursive django_filters tests
+ $ isort --check --diff django_filters tests
To sort the imports, simply remove the ``--check-only`` option.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/docs/guide/install.txt
new/django-filter-2.4.0/docs/guide/install.txt
--- old/django-filter-2.3.0/docs/guide/install.txt 2020-05-14
14:31:54.000000000 +0200
+++ new/django-filter-2.4.0/docs/guide/install.txt 2020-09-26
19:13:46.000000000 +0200
@@ -30,5 +30,5 @@
* **Python**: 3.5, 3.6, 3.7, 3.8
-* **Django**: 2.2, 3.0
+* **Django**: 2.2, 3.0, 3.1
* **DRF**: 3.10+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/docs/guide/usage.txt
new/django-filter-2.4.0/docs/guide/usage.txt
--- old/django-filter-2.3.0/docs/guide/usage.txt 2020-03-04
20:56:36.000000000 +0100
+++ new/django-filter-2.4.0/docs/guide/usage.txt 2020-09-26
19:13:46.000000000 +0200
@@ -176,7 +176,7 @@
.. note::
- It is not guaranteed that a `request` will be provied to the `FilterSet`
+ It is not guaranteed that a `request` will be provided to the `FilterSet`
instance. Any code depending on a request should handle the `None` case.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/docs/ref/filters.txt
new/django-filter-2.4.0/docs/ref/filters.txt
--- old/django-filter-2.3.0/docs/ref/filters.txt 2020-05-14
14:31:54.000000000 +0200
+++ new/django-filter-2.4.0/docs/ref/filters.txt 2020-09-26
19:21:12.000000000 +0200
@@ -426,6 +426,12 @@
Filters based on a numerical value, used with ``IntegerField``, ``FloatField``,
and ``DecimalField`` by default.
+.. method:: NumberFilter.get_max_validator()
+
+ Return a ``MaxValueValidator`` instance that will be added to
+ ``field.validators``. By default uses a limit value of ``1e50``. Return
+ ``None`` to disable maximum value validation.
+
``NumericRangeFilter``
~~~~~~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/requirements/maintainer.txt
new/django-filter-2.4.0/requirements/maintainer.txt
--- old/django-filter-2.3.0/requirements/maintainer.txt 2020-03-04
20:05:12.000000000 +0100
+++ new/django-filter-2.4.0/requirements/maintainer.txt 2020-09-26
19:46:42.000000000 +0200
@@ -2,11 +2,10 @@
argh==0.26.1
Babel==2.2.0
backports.ssl-match-hostname==3.4.0.2
-bumpversion==0.5.3
certifi==2015.9.6.2
docutils==0.12
funcsigs==0.4
-Jinja2==2.8
+Jinja2>=2.10.1
livereload==2.4.0
MarkupSafe==0.23
pathtools==0.1.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/setup.cfg
new/django-filter-2.4.0/setup.cfg
--- old/django-filter-2.3.0/setup.cfg 2020-06-05 16:45:54.000000000 +0200
+++ new/django-filter-2.4.0/setup.cfg 2020-09-27 11:08:50.000000000 +0200
@@ -5,7 +5,7 @@
skip = .tox
atomic = true
multi_line_output = 3
-known_standard_library = mock
+extra_standard_library = mock
known_third_party = django,pytz,rest_framework
known_first_party = django_filters
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/setup.py
new/django-filter-2.4.0/setup.py
--- old/django-filter-2.3.0/setup.py 2020-06-05 16:35:31.000000000 +0200
+++ new/django-filter-2.4.0/setup.py 2020-09-27 11:08:45.000000000 +0200
@@ -2,29 +2,32 @@
import sys
from setuptools import setup, find_packages
+# FIXME: Main module requires django to be present, so cannot run setup.py in
+# clean environment.
+# from django_filters import __version__
+__version__ = '2.4.0'
+
f = open('README.rst')
readme = f.read()
f.close()
-version = '2.3.0'
-
if sys.argv[-1] == 'publish':
- if os.system("pip freeze | grep wheel"):
- print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
- sys.exit()
- if os.system("pip freeze | grep twine"):
- print("twine not installed.\nUse `pip install twine`.\nExiting.")
- sys.exit()
+# if os.system("pip freeze | grep wheel"):
+# print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
+# sys.exit()
+# if os.system("pip freeze | grep twine"):
+# print("twine not installed.\nUse `pip install twine`.\nExiting.")
+# sys.exit()
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
print("You probably want to also tag the version now:")
- print(" git tag -a %s -m 'version %s'" % (version, version))
+ print(" git tag -a %s -m 'version %s'" % (__version__, __version__))
print(" git push --tags")
sys.exit()
setup(
name='django-filter',
- version=version,
+ version=__version__,
description=('Django-filter is a reusable Django application for allowing'
' users to filter querysets dynamically.'),
long_description=readme,
@@ -45,12 +48,14 @@
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
+ 'Framework :: Django :: 3.1',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
'Framework :: Django',
],
zip_safe=False,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/tests/models.py
new/django-filter-2.4.0/tests/models.py
--- old/django-filter-2.3.0/tests/models.py 2020-03-04 20:05:12.000000000
+0100
+++ new/django-filter-2.4.0/tests/models.py 2020-09-26 19:13:46.000000000
+0200
@@ -47,7 +47,7 @@
status = models.IntegerField(choices=STATUS_CHOICES, default=0)
is_active = models.BooleanField(default=False)
- is_employed = models.NullBooleanField(default=False)
+ is_employed = models.BooleanField(null=True, default=False)
favorite_books = models.ManyToManyField('Book', related_name='lovers')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-filter-2.3.0/tests/rest_framework/test_integration.py
new/django-filter-2.4.0/tests/rest_framework/test_integration.py
--- old/django-filter-2.3.0/tests/rest_framework/test_integration.py
2018-07-13 11:44:46.000000000 +0200
+++ new/django-filter-2.4.0/tests/rest_framework/test_integration.py
2020-09-26 19:13:46.000000000 +0200
@@ -1,10 +1,9 @@
import datetime
from decimal import Decimal
-from django.conf.urls import url
from django.test import TestCase
from django.test.utils import override_settings
-from django.urls import reverse
+from django.urls import path, reverse
from django.utils.dateparse import parse_date
from rest_framework import generics, serializers, status
from rest_framework.test import APIRequestFactory
@@ -111,9 +110,9 @@
urlpatterns = [
- url(r'^(?P<pk>\d+)/$', FilterClassDetailView.as_view(),
name='detail-view'),
- url(r'^$', FilterClassRootView.as_view(), name='root-view'),
- url(r'^get-queryset/$', GetQuerysetView.as_view(),
name='get-queryset-view'),
+ path('<int:pk>/', FilterClassDetailView.as_view(), name='detail-view'),
+ path('', FilterClassRootView.as_view(), name='root-view'),
+ path('get-queryset/', GetQuerysetView.as_view(), name='get-queryset-view'),
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/tests/test_filterset.py
new/django-filter-2.4.0/tests/test_filterset.py
--- old/django-filter-2.3.0/tests/test_filterset.py 2020-03-04
20:59:02.000000000 +0100
+++ new/django-filter-2.4.0/tests/test_filterset.py 2020-09-26
19:13:46.000000000 +0200
@@ -43,13 +43,6 @@
from .utils import MockQuerySet
-def checkItemsEqual(L1, L2):
- """
- TestCase.assertItemsEqual() is not available in Python 2.6.
- """
- return len(L1) == len(L2) and sorted(L1) == sorted(L2)
-
-
class HelperMethodsTests(TestCase):
@unittest.skip('todo')
@@ -433,7 +426,7 @@
self.assertEqual(len(F.base_filters), 3)
expected_list = ['price', 'price__gte', 'price__lte', ]
- self.assertTrue(checkItemsEqual(list(F.base_filters), expected_list))
+ self.assertCountEqual(list(F.base_filters), expected_list)
@override_settings(FILTERS_DEFAULT_LOOKUP_EXPR='lte')
def test_meta_fields_dictionary_derived_other_default_lookup(self):
@@ -447,7 +440,7 @@
self.assertEqual(len(F.base_filters), 3)
expected_list = ['price__exact', 'price__gte', 'price', ]
- self.assertTrue(checkItemsEqual(list(F.base_filters), expected_list))
+ self.assertCountEqual(list(F.base_filters), expected_list)
def test_meta_fields_containing_autofield(self):
class F(FilterSet):
@@ -476,7 +469,7 @@
self.assertEqual(len(F.base_filters), 2)
expected_list = ['id', 'username']
- self.assertTrue(checkItemsEqual(list(F.base_filters), expected_list))
+ self.assertCountEqual(list(F.base_filters), expected_list)
def test_meta_fields_list_containing_unknown_fields(self):
msg = ("'Meta.fields' must not contain non-model field names: "
@@ -683,7 +676,7 @@
self.assertEqual(len(F.base_filters), 2)
expected_list = ['published', 'published__year']
- self.assertTrue(checkItemsEqual(list(F.base_filters), expected_list))
+ self.assertCountEqual(list(F.base_filters), expected_list)
def test_declared_filter_multiple_inheritance(self):
class A(FilterSet):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/tests/test_forms.py
new/django-filter-2.4.0/tests/test_forms.py
--- old/django-filter-2.3.0/tests/test_forms.py 2017-10-24 11:14:54.000000000
+0200
+++ new/django-filter-2.4.0/tests/test_forms.py 2020-09-26 19:13:46.000000000
+0200
@@ -255,3 +255,17 @@
self.assertFalse(f.is_valid())
self.assertEqual(f.data, {'price': 'four dollars'})
self.assertEqual(f.errors, {'price': ['Enter a number.']})
+
+ def test_number_filter_max_value_validation(self):
+ class F(FilterSet):
+ class Meta:
+ model = Book
+ fields = ['average_rating']
+
+ f = F({'average_rating': '1E1001'})
+ self.assertTrue(f.is_bound)
+ self.assertFalse(f.is_valid())
+ self.assertEqual(
+ f.errors,
+ {'average_rating': ['Ensure this value is less than or equal to
1e+50.']}
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/tests/urls.py
new/django-filter-2.4.0/tests/urls.py
--- old/django-filter-2.3.0/tests/urls.py 2018-07-13 11:44:46.000000000
+0200
+++ new/django-filter-2.4.0/tests/urls.py 2020-09-26 19:13:46.000000000
+0200
@@ -1,4 +1,4 @@
-from django.conf.urls import url
+from django.urls import path
from django_filters.views import FilterView, object_filter
@@ -10,6 +10,6 @@
urlpatterns = [
- url(r'^books-legacy/$', object_filter, {'model': Book, 'extra_context':
{'foo': _foo, 'bar': 'foo'}}),
- url(r'^books/$', FilterView.as_view(model=Book)),
+ path('books-legacy/', object_filter, {'model': Book, 'extra_context':
{'foo': _foo, 'bar': 'foo'}}),
+ path('books/', FilterView.as_view(model=Book)),
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-filter-2.3.0/tests/utils.py
new/django-filter-2.4.0/tests/utils.py
--- old/django-filter-2.3.0/tests/utils.py 2018-07-13 11:45:02.000000000
+0200
+++ new/django-filter-2.4.0/tests/utils.py 2020-09-26 19:13:46.000000000
+0200
@@ -3,13 +3,19 @@
from django.db import models
+class QuerySet(models.QuerySet):
+
+ def __bool__(self):
+ return True
+
+
class MockQuerySet:
"""
Generate a mock that is suitably similar to a QuerySet
"""
def __new__(self):
- m = mock.Mock(spec_set=models.QuerySet())
+ m = mock.Mock(spec_set=QuerySet())
m.filter.return_value = m
m.all.return_value = m
return m