Skip to content

Commit

Permalink
Pre commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbruinsslot committed Aug 31, 2023
1 parent 564edfb commit 37a88df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 9 additions & 2 deletions mula/scheduler/queues/pq.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,17 @@ def push(self, p_item: models.PrioritizedItem) -> Optional[models.PrioritizedIte
)

if item_on_queue and item_changed and not self.allow_updates:
message = "Item already on queue, and item changed, we're not allowed to update the item that is already on the queue."
message = (
"Item already on queue, and item changed, we're not "
"allowed to update the item that is already on the queue."
)

if item_on_queue and priority_changed and not self.allow_priority_updates:
message = "Item already on queue, and priority changed, we're not allowed to update the priority of the item that is already on the queue."
message = (
"Item already on queue, and priority changed, "
"we're not allowed to update the priority of the item "
"that is already on the queue."
)

raise NotAllowedError(message)

Expand Down
6 changes: 4 additions & 2 deletions mula/tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def test_push_updates_not_allowed(self):
self.assertEqual(1, self.scheduler.queue.qsize())
self.assertEqual(
response.json().get("detail"),
"Item already on queue, and item changed, we're not allowed to update the item that is already on the queue.",
"Item already on queue, and item changed, we're not allowed to "
"update the item that is already on the queue.",
)

def test_push_updates_allowed(self):
Expand Down Expand Up @@ -286,7 +287,8 @@ def test_push_priority_updates_not_allowed(self):
self.assertEqual(1, self.scheduler.queue.qsize())
self.assertEqual(
response.json().get("detail"),
"Item already on queue, and priority changed, we're not allowed to update the priority of the item that is already on the queue.",
"Item already on queue, and priority changed, we're not allowed to "
"update the priority of the item that is already on the queue.",
)

def test_update_priority_higher(self):
Expand Down

0 comments on commit 37a88df

Please sign in to comment.