chore: bring the test suite up to ruff's standards
Mostly automatic: empty f-strings, unused imports, formatting. The manual half was duplicated import blocks stranded mid-file and `== None` assertions, which become `is None` here because they compare plain attributes -- unlike the identical rule in filters/book.py, where they build SQL. Two unused variables are the tests never checking the disk in either delete_files direction. Left in place under a noqa so the gap stays visible.
This commit is contained in:
@@ -54,7 +54,8 @@ class TestNormalizeTitle:
|
||||
assert normalize_title("The") == "the"
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"title", ["Catch 22", "Fahrenheit 451", "Blade Runner 2049", "1984", "Apollo 13"]
|
||||
"title",
|
||||
["Catch 22", "Fahrenheit 451", "Blade Runner 2049", "1984", "Apollo 13"],
|
||||
)
|
||||
def test_a_number_is_not_an_edition(self, title: str) -> None:
|
||||
"""Edition stripping keys on the `e`; a bare number is part of the title."""
|
||||
@@ -163,8 +164,13 @@ class TestNormalizeIdentifier:
|
||||
|
||||
def test_uuids_are_refused(self) -> None:
|
||||
"""Generated per build, so they only re-find what the hash check catches."""
|
||||
assert normalize_identifier("uuid", "3f2b1c4e-1111-2222-3333-444455556666") is None
|
||||
assert normalize_identifier("urn:uuid", "3f2b1c4e-1111-2222-3333-444455556666") is None
|
||||
assert (
|
||||
normalize_identifier("uuid", "3f2b1c4e-1111-2222-3333-444455556666") is None
|
||||
)
|
||||
assert (
|
||||
normalize_identifier("urn:uuid", "3f2b1c4e-1111-2222-3333-444455556666")
|
||||
is None
|
||||
)
|
||||
|
||||
def test_other_schemes_keep_their_own_key(self) -> None:
|
||||
assert normalize_identifier("asin", "B000FC0PDA") == "asin:b000fc0pda"
|
||||
@@ -187,7 +193,9 @@ class TestIsbnConversion:
|
||||
assert isbn10_to_isbn13("043942089X") == "9780439420891"
|
||||
|
||||
@pytest.mark.parametrize("isbn", ["0486282113", "9780486282114", "nonsense"])
|
||||
def test_anything_that_is_not_an_isbn_10_converts_to_nothing(self, isbn: str) -> None:
|
||||
def test_anything_that_is_not_an_isbn_10_converts_to_nothing(
|
||||
self, isbn: str
|
||||
) -> None:
|
||||
assert isbn10_to_isbn13(isbn) is None
|
||||
|
||||
|
||||
@@ -219,7 +227,7 @@ class TestParseIdentifier:
|
||||
assert parse_identifier("B000FC0PDA", "mobi-asin") == ("asin", "B000FC0PDA")
|
||||
|
||||
def test_an_unrecognised_prefix_is_part_of_the_value(self) -> None:
|
||||
""""http://example.com/book" is not an identifier called "http"."""
|
||||
""" "http://example.com/book" is not an identifier called "http"."""
|
||||
assert parse_identifier("http://www.gutenberg.org/5200") == (
|
||||
"id",
|
||||
"http://www.gutenberg.org/5200",
|
||||
|
||||
Reference in New Issue
Block a user