From 30db4d21128c748c93da2010a9e0089511a815a6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:11:13 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- simple_history/tests/models.py | 1 - simple_history/tests/tests/test_utils.py | 26 ++++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/simple_history/tests/models.py b/simple_history/tests/models.py index 746a4fe4..886201cb 100644 --- a/simple_history/tests/models.py +++ b/simple_history/tests/models.py @@ -141,7 +141,6 @@ def get_absolute_url(self): return reverse("poll-detail", kwargs={"pk": self.pk}) - class PollWithManyToMany(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField("date published") diff --git a/simple_history/tests/tests/test_utils.py b/simple_history/tests/tests/test_utils.py index 7677923e..3a36fc9f 100644 --- a/simple_history/tests/tests/test_utils.py +++ b/simple_history/tests/tests/test_utils.py @@ -290,7 +290,7 @@ def test_bulk_create_no_ids_return(self, hist_manager_mock): default_user=None, default_change_reason=None, default_date=None, - custom_historical_attrs=None + custom_historical_attrs=None, ) @@ -513,15 +513,15 @@ def test_bulk_update_history_wrong_manager(self): class CustomHistoricalAttrsTest(TestCase): - def test_bulk_create_history_with_custom_model_attributes(self): data = [ - PollWithHistoricalSessionAttr(id=x, question='Question ' + str(x)) + PollWithHistoricalSessionAttr(id=x, question="Question " + str(x)) for x in range(5) ] bulk_create_with_history( - data, PollWithHistoricalSessionAttr, - custom_historical_attrs={'session': 'jam'} + data, + PollWithHistoricalSessionAttr, + custom_historical_attrs={"session": "jam"}, ) self.assertEqual(PollWithHistoricalSessionAttr.objects.count(), 5) @@ -532,38 +532,38 @@ def test_bulk_create_history_with_custom_model_attributes(self): def test_bulk_update_history_with_custom_model_attributes(self): create_data = [ - PollWithHistoricalSessionAttr(id=x, question='Question ' + str(x)) + PollWithHistoricalSessionAttr(id=x, question="Question " + str(x)) for x in range(5) ] bulk_create_with_history(create_data, PollWithHistoricalSessionAttr) update_data = [ - PollWithHistoricalSessionAttr(id=x, question='Q' + str(x)) - for x in range(5) + PollWithHistoricalSessionAttr(id=x, question="Q" + str(x)) for x in range(5) ] bulk_update_with_history( update_data, PollWithHistoricalSessionAttr, fields=["question"], - custom_historical_attrs={'session': 'training'} + custom_historical_attrs={"session": "training"}, ) self.assertTrue( - all([ + all( + [ history.session == "training" for history in PollWithHistoricalSessionAttr.history.filter( history_type="~" ) - ]) + ] + ) ) def test_bulk_manager_with_custom_model_attributes(self): history_manager = get_history_manager_for_model(PollWithHistoricalSessionAttr) history_manager.bulk_history_create( - [], - custom_historical_attrs={'session': 'co-op'} + [], custom_historical_attrs={"session": "co-op"} ) self.assertTrue(