Skip to content

Commit fc1b3db

Browse files
[pre-commit.ci] pre-commit autoupdate (#1258)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](asottile/pyupgrade@v3.10.1...v3.11.0) * Replaced deprecated assertQuerysetEqual() ...with `assertQuerySetEqual()` (notice the uppercase S in "QuerySet"), when Django is 4.2 or higher. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Anders <[email protected]>
1 parent aa87e7c commit fc1b3db

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ repos:
4747
- "--strict"
4848

4949
- repo: https://github.com/asottile/pyupgrade
50-
rev: v3.10.1
50+
rev: v3.11.0
5151
hooks:
5252
- id: pyupgrade
5353
args: [--py38-plus]

simple_history/tests/tests/test_manager.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime, timedelta
22
from operator import attrgetter
33

4+
import django
45
from django.contrib.auth import get_user_model
56
from django.db import IntegrityError
67
from django.test import TestCase, override_settings, skipUnlessDBFeature
@@ -198,10 +199,17 @@ def setUp(self):
198199
Poll(id=4, question="Question 4", pub_date=datetime.now()),
199200
]
200201

202+
# DEV: Remove this method when the minimum required Django version is 4.2
203+
def assertQuerySetEqual(self, *args, **kwargs):
204+
if django.VERSION < (4, 2):
205+
return self.assertQuerysetEqual(*args, **kwargs)
206+
else:
207+
return super().assertQuerySetEqual(*args, **kwargs)
208+
201209
def test_simple_bulk_history_create(self):
202210
created = Poll.history.bulk_history_create(self.data)
203211
self.assertEqual(len(created), 4)
204-
self.assertQuerysetEqual(
212+
self.assertQuerySetEqual(
205213
Poll.history.order_by("question"),
206214
["Question 1", "Question 2", "Question 3", "Question 4"],
207215
attrgetter("question"),
@@ -326,10 +334,17 @@ def setUp(self):
326334
Poll(id=4, question="Question 4", pub_date=datetime.now()),
327335
]
328336

337+
# DEV: Remove this method when the minimum required Django version is 4.2
338+
def assertQuerySetEqual(self, *args, **kwargs):
339+
if django.VERSION < (4, 2):
340+
return self.assertQuerysetEqual(*args, **kwargs)
341+
else:
342+
return super().assertQuerySetEqual(*args, **kwargs)
343+
329344
def test_simple_bulk_history_create(self):
330345
created = Poll.history.bulk_history_create(self.data, update=True)
331346
self.assertEqual(len(created), 4)
332-
self.assertQuerysetEqual(
347+
self.assertQuerySetEqual(
333348
Poll.history.order_by("question"),
334349
["Question 1", "Question 2", "Question 3", "Question 4"],
335350
attrgetter("question"),

0 commit comments

Comments
 (0)