Skip to content

Commit

Permalink
Upgrade to Ruff 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed Jul 5, 2024
1 parent 39a9574 commit b649315
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 67 deletions.
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ignore = [
'D401',
'F501',
'PTH123',
'SIM103',
]

[lint.per-file-ignores]
Expand Down
12 changes: 6 additions & 6 deletions betty/tests/extension/cotton_candy/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def test_build_empty(self, new_temporary_app: App) -> None:
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []

async def test_build_person_without_names(self, new_temporary_app: App) -> None:
person_id = "P1"
Expand All @@ -50,7 +50,7 @@ async def test_build_person_without_names(self, new_temporary_app: App) -> None:
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []

async def test_build_private_person(self, new_temporary_app: App) -> None:
person_id = "P1"
Expand Down Expand Up @@ -80,7 +80,7 @@ async def test_build_private_person(self, new_temporary_app: App) -> None:
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []

@pytest.mark.parametrize(
("expected", "locale"),
Expand Down Expand Up @@ -270,7 +270,7 @@ async def test_build_private_place(self, new_temporary_app: App) -> None:
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []

async def test_build_file_without_description(self, new_temporary_app: App) -> None:
file_id = "F1"
Expand All @@ -295,7 +295,7 @@ async def test_build_file_without_description(self, new_temporary_app: App) -> N
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []

@pytest.mark.parametrize(
("expected", "locale"),
Expand Down Expand Up @@ -354,4 +354,4 @@ async def test_build_private_file(self, new_temporary_app: App) -> None:
async for item in Index(project, Context(), DEFAULT_LOCALIZER).build()
]

assert [] == indexed
assert indexed == []
2 changes: 1 addition & 1 deletion betty/tests/extension/gramps/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ async def test_remove_family_tree(
betty_qtbot.mouse_click(widget._family_trees._family_trees_remove_buttons[0])

assert len(sut.configuration.family_trees) == 0
assert [] == widget._family_trees._family_trees_remove_buttons
assert widget._family_trees._family_trees_remove_buttons == []
16 changes: 8 additions & 8 deletions betty/tests/model/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ async def test_clear(self) -> None:
entity3 = SingleTypeEntityCollectionTestEntity()
sut.add(entity1, entity2, entity3)
sut.clear()
assert [] == list(sut)
assert list(sut) == []

async def test_list(self) -> None:
sut = SingleTypeEntityCollection[Entity](Entity)
Expand Down Expand Up @@ -423,7 +423,7 @@ async def test_remove(self) -> None:
sut.remove(entity_one)
assert [entity_other] == list(sut)
sut.remove(entity_other)
assert [] == list(sut)
assert list(sut) == []

async def test_getitem_by_index(self) -> None:
sut = MultipleTypesEntityCollection[Entity]()
Expand Down Expand Up @@ -451,7 +451,7 @@ async def test_getitem_by_entity_type(self) -> None:
assert [entity_one] == list(sut[MultipleTypesEntityCollectionTestEntityOne])
assert [entity_other] == list(sut[MultipleTypesEntityCollectionTestEntityOther])
# Ensure that getting previously unseen entity types automatically creates and returns a new collection.
assert [] == list(sut[Entity])
assert list(sut[Entity]) == []

async def test_getitem_by_entity_type_name(self) -> None:
sut = MultipleTypesEntityCollection[Entity]()
Expand Down Expand Up @@ -1151,7 +1151,7 @@ async def test(self) -> None:

del entity_many.one
assert entity_many.one is None
assert [] == list(entity_one.many) # type: ignore[unreachable]
assert list(entity_one.many) == [] # type: ignore[unreachable]


@to_many(
Expand Down Expand Up @@ -1182,7 +1182,7 @@ async def test(self) -> None:
assert [entity_many] == list(entity_one.many)

entity_one.many.remove(entity_many)
assert [] == list(entity_one.many)
assert list(entity_one.many) == []


@one_to_many(
Expand Down Expand Up @@ -1220,7 +1220,7 @@ async def test(self) -> None:
assert entity_one is entity_many.one

entity_one.many.remove(entity_many)
assert [] == list(entity_one.many)
assert list(entity_one.many) == []
assert entity_many.one is None


Expand Down Expand Up @@ -1259,8 +1259,8 @@ async def test(self) -> None:
assert [entity_many] == list(entity_other_many.many)

entity_many.other_many.remove(entity_other_many)
assert [] == list(entity_many.other_many)
assert [] == list(entity_other_many.many)
assert list(entity_many.other_many) == []
assert list(entity_other_many.many) == []


@many_to_one_to_many(
Expand Down
Loading

0 comments on commit b649315

Please sign in to comment.