mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Chore: Enable ruff FBT (#8645)
This commit is contained in:

committed by
GitHub

parent
b274665e21
commit
e560fa3be0
@@ -165,6 +165,7 @@ class TestCustomFieldsSearch(DirectoriesMixin, APITestCase):
|
||||
self,
|
||||
query: list,
|
||||
reference_predicate: Callable[[DocumentWrapper], bool],
|
||||
*,
|
||||
match_nothing_ok=False,
|
||||
):
|
||||
"""
|
||||
|
@@ -535,7 +535,12 @@ class TestPDFActions(DirectoriesMixin, TestCase):
|
||||
metadata_document_id = self.doc1.id
|
||||
user = User.objects.create(username="test_user")
|
||||
|
||||
result = bulk_edit.merge(doc_ids, None, False, user)
|
||||
result = bulk_edit.merge(
|
||||
doc_ids,
|
||||
metadata_document_id=None,
|
||||
delete_originals=False,
|
||||
user=user,
|
||||
)
|
||||
|
||||
expected_filename = (
|
||||
f"{'_'.join([str(doc_id) for doc_id in doc_ids])[:100]}_merged.pdf"
|
||||
@@ -638,7 +643,7 @@ class TestPDFActions(DirectoriesMixin, TestCase):
|
||||
doc_ids = [self.doc2.id]
|
||||
pages = [[1, 2], [3]]
|
||||
user = User.objects.create(username="test_user")
|
||||
result = bulk_edit.split(doc_ids, pages, False, user)
|
||||
result = bulk_edit.split(doc_ids, pages, delete_originals=False, user=user)
|
||||
self.assertEqual(mock_consume_file.call_count, 2)
|
||||
consume_file_args, _ = mock_consume_file.call_args
|
||||
self.assertEqual(consume_file_args[1].title, "B (split 2)")
|
||||
|
@@ -233,7 +233,7 @@ class FaultyGenericExceptionParser(_BaseTestParser):
|
||||
raise Exception("Generic exception.")
|
||||
|
||||
|
||||
def fake_magic_from_file(file, mime=False):
|
||||
def fake_magic_from_file(file, *, mime=False):
|
||||
if mime:
|
||||
if file.name.startswith("invalid_pdf"):
|
||||
return "application/octet-stream"
|
||||
|
@@ -10,7 +10,7 @@ class TestDelayedQuery(TestCase):
|
||||
super().setUp()
|
||||
# all tests run without permission criteria, so has_no_owner query will always
|
||||
# be appended.
|
||||
self.has_no_owner = query.Or([query.Term("has_owner", False)])
|
||||
self.has_no_owner = query.Or([query.Term("has_owner", text=False)])
|
||||
|
||||
def _get_testset__id__in(self, param, field):
|
||||
return (
|
||||
@@ -43,12 +43,12 @@ class TestDelayedQuery(TestCase):
|
||||
def test_get_permission_criteria(self):
|
||||
# tests contains tuples of user instances and the expected filter
|
||||
tests = (
|
||||
(None, [query.Term("has_owner", False)]),
|
||||
(None, [query.Term("has_owner", text=False)]),
|
||||
(User(42, username="foo", is_superuser=True), []),
|
||||
(
|
||||
User(42, username="foo", is_superuser=False),
|
||||
[
|
||||
query.Term("has_owner", False),
|
||||
query.Term("has_owner", text=False),
|
||||
query.Term("owner_id", 42),
|
||||
query.Term("viewer_id", "42"),
|
||||
],
|
||||
|
@@ -93,7 +93,7 @@ class ConsumerThreadMixin(DocumentConsumeDelayMixin):
|
||||
else:
|
||||
print("Consumed a perfectly valid file.") # noqa: T201
|
||||
|
||||
def slow_write_file(self, target, incomplete=False):
|
||||
def slow_write_file(self, target, *, incomplete=False):
|
||||
with open(self.sample_file, "rb") as f:
|
||||
pdf_bytes = f.read()
|
||||
|
||||
|
@@ -188,7 +188,7 @@ class TestExportImport(
|
||||
|
||||
return manifest
|
||||
|
||||
def test_exporter(self, use_filename_format=False):
|
||||
def test_exporter(self, *, use_filename_format=False):
|
||||
shutil.rmtree(os.path.join(self.dirs.media_dir, "documents"))
|
||||
shutil.copytree(
|
||||
os.path.join(os.path.dirname(__file__), "samples", "documents"),
|
||||
|
@@ -23,6 +23,7 @@ class _TestMatchingBase(TestCase):
|
||||
match_algorithm: str,
|
||||
should_match: Iterable[str],
|
||||
no_match: Iterable[str],
|
||||
*,
|
||||
case_sensitive: bool = False,
|
||||
):
|
||||
for klass in (Tag, Correspondent, DocumentType):
|
||||
|
Reference in New Issue
Block a user