Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
valrus committed Dec 31, 2024
1 parent ef00b1c commit 7f469ee
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def test_field_present_in_some_items(self):
"""Test ordering by a (string) field not present on all items."""
# append 'foo' to two items (1,2)
items = self.lib.items("id+")

Check failure on line 505 in test/test_sort.py

View workflow job for this annotation

GitHub Actions / Check linting

Ruff (F841)

test/test_sort.py:505:9: F841 Local variable `items` is assigned to but never used
lower_foo_item, higher_foo_item, *items_without_foo = self.lib.items("id+")
lower_foo_item, higher_foo_item, *items_without_foo = self.lib.items(
"id+"
)
lower_foo_item.foo, higher_foo_item.foo = "bar1", "bar2"
lower_foo_item.store()
higher_foo_item.store()
Expand All @@ -513,22 +515,24 @@ def test_field_present_in_some_items(self):
# items without field first
*[i.id for i in items_without_foo],
lower_foo_item.id,
higher_foo_item.id
higher_foo_item.id,
]

results_desc = list(self.lib.items("foo- id+"))
assert [i.id for i in results_desc] == [
higher_foo_item.id,
lower_foo_item.id,
# items without field last
*[i.id for i in items_without_foo]
*[i.id for i in items_without_foo],
]

@patch("beets.library.Item._types", {"myint": types.Integer()})
def test_int_field_present_in_some_items(self):
"""Test ordering by an int-type field not present on all items."""
# append int-valued 'myint' to two items (1,2)
lower_myint_item, higher_myint_item, *items_without_myint = self.lib.items("id+")
lower_myint_item, higher_myint_item, *items_without_myint = (
self.lib.items("id+")
)
lower_myint_item.myint, higher_myint_item.myint = 1, 2
lower_myint_item.store()
higher_myint_item.store()
Expand All @@ -538,15 +542,15 @@ def test_int_field_present_in_some_items(self):
# items without field first
*[i.id for i in items_without_myint],
lower_myint_item.id,
higher_myint_item.id
higher_myint_item.id,
]

results_desc = list(self.lib.items("myint- id+"))
assert [i.id for i in results_desc] == [
higher_myint_item.id,
lower_myint_item.id,
# items without field last
*[i.id for i in items_without_myint]
*[i.id for i in items_without_myint],
]

def test_negation_interaction(self):
Expand Down

0 comments on commit 7f469ee

Please sign in to comment.