Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 25, 2023
1 parent dd40ec4 commit e4cc4fb
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions simple_history/tests/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand Down Expand Up @@ -513,18 +513,17 @@ def test_bulk_update_history_wrong_manager(self):


class CustomHistoricalAttrsTest(TestCase):

def setUp(self):
self.data = [
PollWithHistoricalSessionAttr(id=x, question="Question " + str(x))
for x in range(5)
]

def test_bulk_create_history_with_custom_model_attributes(self):

bulk_create_with_history(
self.data, PollWithHistoricalSessionAttr,
custom_historical_attrs={"session": "jam"}
self.data,
PollWithHistoricalSessionAttr,
custom_historical_attrs={"session": "jam"},
)

self.assertEqual(PollWithHistoricalSessionAttr.objects.count(), 5)
Expand All @@ -535,31 +534,31 @@ def test_bulk_create_history_with_custom_model_attributes(self):

def test_bulk_update_history_with_custom_model_attributes(self):
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(
Expand Down

0 comments on commit e4cc4fb

Please sign in to comment.