From 5fb5f82c893c7b2138cb6577f29e4c72305d6f1e Mon Sep 17 00:00:00 2001 From: PascalEgn Date: Tue, 13 Aug 2024 15:17:15 +0200 Subject: [PATCH] global: enforce line length --- .../combine-durations/combine_durations.py | 9 +- backend/inspirehep/accounts/views.py | 3 +- ...551a8_update_values_in_authorschematype.py | 9 +- ...2_update_constraints_in_records_authors.py | 6 +- ...22b_add_recid_to_recordsauthors_id_type.py | 3 +- ...7b2_change_record_citations_to_records_.py | 12 +- backend/inspirehep/assign/views.py | 3 +- backend/inspirehep/cds/api.py | 12 +- backend/inspirehep/cds/cli.py | 8 +- backend/inspirehep/curation/errors.py | 5 +- .../curation/search_check_do/base.py | 9 +- .../curation/search_check_do/examples.py | 10 +- backend/inspirehep/curation/utils.py | 6 +- backend/inspirehep/disambiguation/cli.py | 15 +- backend/inspirehep/editor/authorlist_utils.py | 2 +- backend/inspirehep/editor/editor_soft_lock.py | 10 +- backend/inspirehep/editor/errors.py | 5 +- backend/inspirehep/editor/views.py | 3 +- backend/inspirehep/hal/tasks.py | 7 +- backend/inspirehep/hepdata/cli.py | 8 +- backend/inspirehep/indexer/base.py | 12 +- backend/inspirehep/indexer/cli.py | 46 +- backend/inspirehep/logger/ext.py | 6 +- backend/inspirehep/mailing/api/conferences.py | 5 +- backend/inspirehep/mailing/cli.py | 5 +- backend/inspirehep/matcher/api.py | 13 +- backend/inspirehep/matcher/parsers.py | 3 +- backend/inspirehep/matcher/validators.py | 8 +- backend/inspirehep/orcid/domain_models.py | 17 +- backend/inspirehep/orcid/exceptions.py | 5 +- backend/inspirehep/pidstore/cli.py | 38 +- backend/inspirehep/pidstore/errors.py | 25 +- backend/inspirehep/pidstore/providers/cnum.py | 9 +- .../inspirehep/pidstore/providers/recid.py | 4 +- .../inspirehep/pidstore/providers/texkey.py | 3 +- backend/inspirehep/records/api/authors.py | 2 +- backend/inspirehep/records/api/base.py | 21 +- backend/inspirehep/records/api/mixins.py | 11 +- backend/inspirehep/records/cli.py | 36 +- backend/inspirehep/records/config.py | 136 ++++-- backend/inspirehep/records/errors.py | 15 +- backend/inspirehep/records/links.py | 11 +- .../records/marshmallow/literature/bibtex.py | 28 +- .../records/marshmallow/literature/ui.py | 9 +- .../inspirehep/records/serializers/bibtex.py | 5 +- backend/inspirehep/records/tasks.py | 11 +- backend/inspirehep/records/utils.py | 7 +- backend/inspirehep/records/views.py | 10 +- backend/inspirehep/search/aggregations.py | 5 +- backend/inspirehep/search/api.py | 9 +- backend/inspirehep/search/facets.py | 24 +- backend/inspirehep/search/utils.py | 9 +- backend/inspirehep/serializers.py | 3 +- backend/inspirehep/snow/api.py | 4 +- backend/inspirehep/tools/views.py | 8 +- .../helpers/factories/db/invenio_records.py | 3 +- .../integration-async/assign/test_tasks.py | 4 +- .../records/indexer/test_fulltext.py | 4 +- .../records/test_record_views.py | 10 +- .../integration-async/records/test_tasks.py | 9 +- .../integration/accounts/test_decorators.py | 10 +- .../tests/integration/accounts/test_views.py | 3 +- .../tests/integration/assign/test_views.py | 60 ++- .../tests/integration/curation/test_api.py | 40 +- .../integration/editor/test_editor_views.py | 85 ++-- .../integration/mailing/test_api_jobs.py | 24 +- backend/tests/integration/matcher/test_api.py | 396 +++++++++++++++++- .../tests/integration/matcher/test_views.py | 19 +- .../orcid/test_orcid_domain_models.py | 5 +- .../orcid/test_orcid_tasks_orcid_push.py | 8 +- .../integration/records/api/test_api_base.py | 6 +- .../records/api/test_api_literature.py | 35 +- .../serializers/json/test_conferences.py | 4 +- .../serializers/json/test_experiments.py | 4 +- .../serializers/json/test_institutions.py | 4 +- .../records/serializers/json/test_jobs.py | 4 +- .../serializers/json/test_literature.py | 17 +- .../records/serializers/test_bibtex.py | 53 ++- .../records/serializers/test_cv.py | 16 +- .../records/serializers/test_latex.py | 76 +++- .../tests/integration/records/test_tasks.py | 124 +++++- .../records/views/test_views_article.py | 9 +- .../records/views/test_views_institutions.py | 4 +- .../records/views/test_views_jobs.py | 4 +- .../records/views/test_views_literature.py | 20 +- .../integration/search/test_aggregations.py | 5 +- backend/tests/integration/search/test_api.py | 72 +++- .../submissions/test_submissions_views.py | 4 +- backend/tests/integration/tools/test_views.py | 108 ++++- .../tests/unit/assign/test_assign_views.py | 5 +- .../unit/editor/test_authorlist_utils.py | 292 +++++++------ backend/tests/unit/mailing/test_utils.py | 15 +- backend/tests/unit/matcher/test_parsers.py | 24 +- backend/tests/unit/matcher/test_utils.py | 10 +- .../literature/common/test_abstract_source.py | 30 +- .../literature/common/test_author.py | 5 +- .../common/test_external_system_identifier.py | 12 +- .../literature/common/test_reference_item.py | 25 +- .../literature/test_base_schema.py | 5 +- .../marshmallow/literature/test_es_schema.py | 5 +- .../test_literature_marshmallow_utils.py | 21 +- .../records/marshmallow/literature/test_ui.py | 5 +- backend/tests/unit/records/test_bibtex.py | 10 +- ruff.toml | 1 - 104 files changed, 1838 insertions(+), 584 deletions(-) diff --git a/.github/actions/combine-durations/combine_durations.py b/.github/actions/combine-durations/combine_durations.py index fe80b25484..313c033152 100644 --- a/.github/actions/combine-durations/combine_durations.py +++ b/.github/actions/combine-durations/combine_durations.py @@ -7,13 +7,15 @@ current_path = Path(".").resolve() print( - f"Combining durations with split-prefix={split_prefix} and durations-path={durations_path} in {current_path}." + f"Combining durations with split-prefix={split_prefix} and" + f" durations-path={durations_path} in {current_path}." ) split_paths = Path(".").glob(f"{split_prefix}*/{durations_path.name}") try: previous_durations = json.loads(durations_path.read_text()) print( - f"Loaded previous durations from {durations_path}, found {len(previous_durations)} test durations." + f"Loaded previous durations from {durations_path}, found" + f" {len(previous_durations)} test durations." ) except FileNotFoundError: previous_durations = {} @@ -31,7 +33,8 @@ } new_durations.update(updated_durations) print( - f"Updated durations from {path} containing {len(updated_durations)} changed test durations." + f"Updated durations from {path} containing {len(updated_durations)} changed" + " test durations." ) durations_path.parent.mkdir(parents=True, exist_ok=True) diff --git a/backend/inspirehep/accounts/views.py b/backend/inspirehep/accounts/views.py index af769cc31d..e087c15b6e 100644 --- a/backend/inspirehep/accounts/views.py +++ b/backend/inspirehep/accounts/views.py @@ -99,7 +99,8 @@ def set_orcid_push_setting(): if len(tokens) != 1: raise ValueError( - f"One token per remote account is expected, but found {len(tokens)} for {orcid}" + f"One token per remote account is expected, but found {len(tokens)} for" + f" {orcid}" ) push_account_literature_to_orcid.apply_async( diff --git a/backend/inspirehep/alembic/3637cb5551a8_update_values_in_authorschematype.py b/backend/inspirehep/alembic/3637cb5551a8_update_values_in_authorschematype.py index 88e6a52887..c4ce2b1df3 100644 --- a/backend/inspirehep/alembic/3637cb5551a8_update_values_in_authorschematype.py +++ b/backend/inspirehep/alembic/3637cb5551a8_update_values_in_authorschematype.py @@ -46,7 +46,8 @@ def upgrade(): "CREATE TABLE tmp_records_authors (LIKE records_authors INCLUDING CONSTRAINTS);" ) op.execute( - f"INSERT INTO tmp_records_authors SELECT * FROM records_authors WHERE id_type IN {new_enum_types};" + "INSERT INTO tmp_records_authors SELECT * FROM records_authors WHERE id_type" + f" IN {new_enum_types};" ) op.execute( "ALTER TABLE tmp_records_authors ALTER COLUMN id_type TYPE VARCHAR(255);" @@ -81,7 +82,8 @@ def upgrade(): op.execute(f"CREATE TYPE enum_author_schema_type AS ENUM {new_enum_types};") op.execute("ALTER TABLE tmp_records_authors RENAME TO records_authors") op.execute( - "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type USING (id_type::enum_author_schema_type);" + "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type" + " USING (id_type::enum_author_schema_type);" ) @@ -91,5 +93,6 @@ def downgrade(): op.execute("DROP TYPE IF EXISTS enum_author_schema_type;") op.execute(f"CREATE TYPE enum_author_schema_type AS ENUM {old_enum_values}") op.execute( - "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type USING (id_type::enum_author_schema_type);" + "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type" + " USING (id_type::enum_author_schema_type);" ) diff --git a/backend/inspirehep/alembic/72d010d89702_update_constraints_in_records_authors.py b/backend/inspirehep/alembic/72d010d89702_update_constraints_in_records_authors.py index 81ced4f003..d64df07e79 100644 --- a/backend/inspirehep/alembic/72d010d89702_update_constraints_in_records_authors.py +++ b/backend/inspirehep/alembic/72d010d89702_update_constraints_in_records_authors.py @@ -20,10 +20,12 @@ def upgrade(): """Upgrade database.""" op.execute("CREATE SEQUENCE records_authors_id_seq OWNED BY records_authors.id;") op.execute( - "SELECT SETVAL('records_authors_id_seq', (select max(id) from records_authors), false)" + "SELECT SETVAL('records_authors_id_seq', (select max(id) from records_authors)," + " false)" ) op.execute( - "ALTER TABLE records_authors ALTER COLUMN id SET DEFAULT nextval('records_authors_id_seq');" + "ALTER TABLE records_authors ALTER COLUMN id SET DEFAULT" + " nextval('records_authors_id_seq');" ) op.execute( "ALTER TABLE records_authors ADD CONSTRAINT pk_authors_records PRIMARY KEY (id)" diff --git a/backend/inspirehep/alembic/b495825c322b_add_recid_to_recordsauthors_id_type.py b/backend/inspirehep/alembic/b495825c322b_add_recid_to_recordsauthors_id_type.py index 6dbd90f81d..f825cbabc5 100644 --- a/backend/inspirehep/alembic/b495825c322b_add_recid_to_recordsauthors_id_type.py +++ b/backend/inspirehep/alembic/b495825c322b_add_recid_to_recordsauthors_id_type.py @@ -51,5 +51,6 @@ def downgrade(): op.execute("DROP TYPE IF EXISTS enum_author_schema_type;") op.execute(f"CREATE TYPE enum_author_schema_type AS ENUM {old_enum_values}") op.execute( - "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type USING (id_type::enum_author_schema_type);" + "ALTER TABLE records_authors ALTER COLUMN id_type TYPE enum_author_schema_type" + " USING (id_type::enum_author_schema_type);" ) diff --git a/backend/inspirehep/alembic/c6570e49b7b2_change_record_citations_to_records_.py b/backend/inspirehep/alembic/c6570e49b7b2_change_record_citations_to_records_.py index 28ce5eca57..1f63a19f05 100644 --- a/backend/inspirehep/alembic/c6570e49b7b2_change_record_citations_to_records_.py +++ b/backend/inspirehep/alembic/c6570e49b7b2_change_record_citations_to_records_.py @@ -19,10 +19,12 @@ def upgrade(): """Upgrade database.""" op.rename_table("record_citations", "records_citations") op.execute( - "ALTER TABLE records_citations RENAME CONSTRAINT fk_record_citations_cited TO fk_records_citations_cited_id" + "ALTER TABLE records_citations RENAME CONSTRAINT fk_record_citations_cited TO" + " fk_records_citations_cited_id" ) op.execute( - "ALTER TABLE records_citations RENAME CONSTRAINT fk_record_citations_citer TO fk_records_citations_citer_id" + "ALTER TABLE records_citations RENAME CONSTRAINT fk_record_citations_citer TO" + " fk_records_citations_citer_id" ) op.execute( "ALTER INDEX idx_citations_cited RENAME TO ix_records_citations_cited_id" @@ -33,10 +35,12 @@ def downgrade(): """Downgrade database.""" op.rename_table("records_citations", "record_citations") op.execute( - "ALTER TABLE record_citations RENAME CONSTRAINT fk_records_citations_cited_id TO fk_record_citations_cited" + "ALTER TABLE record_citations RENAME CONSTRAINT fk_records_citations_cited_id" + " TO fk_record_citations_cited" ) op.execute( - "ALTER TABLE record_citations RENAME CONSTRAINT fk_records_citations_citer_id TO fk_record_citations_citer" + "ALTER TABLE record_citations RENAME CONSTRAINT fk_records_citations_citer_id" + " TO fk_record_citations_citer" ) op.execute( "ALTER INDEX ix_records_citations_cited_id RENAME TO idx_citations_cited" diff --git a/backend/inspirehep/assign/views.py b/backend/inspirehep/assign/views.py index 9c5b5197ee..cecb457e9c 100644 --- a/backend/inspirehep/assign/views.py +++ b/backend/inspirehep/assign/views.py @@ -60,7 +60,8 @@ def assign_to_new_stub_author(author_record, literature_recids): stub_author_data = update_author_names({"name": {}}, author_signatures) else: LOGGER.warning( - "Author not found in literature authors, creating stub author with author record data", + "Author not found in literature authors, creating stub author with author" + " record data", author_recid=from_author_recid, ) stub_author_data = {"name": author_record["name"]} diff --git a/backend/inspirehep/cds/api.py b/backend/inspirehep/cds/api.py index 9f0e02e1c1..4c803058bc 100644 --- a/backend/inspirehep/cds/api.py +++ b/backend/inspirehep/cds/api.py @@ -40,7 +40,8 @@ def sync_identifiers(since=None): since = since or last_run_date if not since: LOGGER.error( - "CDS Sync failed. No `since` provided and no successful runs in DB. Aborting." + "CDS Sync failed. No `since` provided and no successful runs in DB." + " Aborting." ) raise CDSSyncError("Missing `since` date") @@ -144,10 +145,11 @@ def get_record_for_provided_ids(control_numbers, arxivs, dois, report_numbers): for report_number in report_numbers: arxiv = report_number.lower().split("arxiv:")[-1] # Report numbers might contain arxivs or normal report numbers - if is_arxiv(arxiv): - record_object = get_record_for_pid_or_none("arxiv", arxiv) - else: - record_object = query_report_number(report_number) + record_object = ( + get_record_for_pid_or_none("arxiv", arxiv) + if is_arxiv(arxiv) + else query_report_number(report_number) + ) if record_object: LOGGER.info( "Matched record by `report_number`", diff --git a/backend/inspirehep/cds/cli.py b/backend/inspirehep/cds/cli.py index bb05ca9c79..b386637770 100644 --- a/backend/inspirehep/cds/cli.py +++ b/backend/inspirehep/cds/cli.py @@ -25,7 +25,10 @@ def cds(): "-s", "since", default=None, - help="Date from when CDS should be synced. If not provided last successful run date will be used.", + help=( + "Date from when CDS should be synced. If not provided last successful run date" + " will be used." + ), ) @with_appcontext def sync(since=None): @@ -43,7 +46,8 @@ def sync(since=None): since = datetime.strptime(since, "%Y-%m-%d").date() except ValueError as e: raise WrongDateFormat( - f"`since`: {since} is in wrong format. Should be in ISO format: YYYY-MM-DD." + f"`since`: {since} is in wrong format. Should be in ISO format:" + " YYYY-MM-DD." ) from e try: click.echo("Starting CDS Sync.") diff --git a/backend/inspirehep/curation/errors.py b/backend/inspirehep/curation/errors.py index 10a81c8e7a..1cef577a28 100644 --- a/backend/inspirehep/curation/errors.py +++ b/backend/inspirehep/curation/errors.py @@ -10,4 +10,7 @@ def __init__(self, collaboration_id, subgroup, **kwargs): super().__init__(**kwargs) self.collaboration_id = collaboration_id self.subgroup_missing = subgroup - self.message = f"Subgroup {self.subgroup_missing} was not found in collaboration {self.collaboration_id} (normalization problem)." + self.message = ( + f"Subgroup {self.subgroup_missing} was not found in collaboration" + f" {self.collaboration_id} (normalization problem)." + ) diff --git a/backend/inspirehep/curation/search_check_do/base.py b/backend/inspirehep/curation/search_check_do/base.py index 1f1d449de3..c91525f990 100644 --- a/backend/inspirehep/curation/search_check_do/base.py +++ b/backend/inspirehep/curation/search_check_do/base.py @@ -63,10 +63,11 @@ def search(self): search_instance = self.search_class() # For literature, `query_from_iq` does unwanted permission checks, # so we work around it - if isinstance(search_instance, LiteratureSearch): - query = search_instance.query(IQ(self.query, search_instance)) - else: - query = search_instance.query_from_iq(self.query) + query = ( + search_instance.query(IQ(self.query, search_instance)) + if isinstance(search_instance, LiteratureSearch) + else search_instance.query_from_iq(self.query) + ) query = query.params(_source={}, size=self.size, scroll="60m") if shard_filter := self._current_shard_filter(): query = query.filter("script", script=shard_filter) diff --git a/backend/inspirehep/curation/search_check_do/examples.py b/backend/inspirehep/curation/search_check_do/examples.py index 83fe1063b7..63edab91db 100644 --- a/backend/inspirehep/curation/search_check_do/examples.py +++ b/backend/inspirehep/curation/search_check_do/examples.py @@ -180,7 +180,10 @@ def do(record, logger, state): class MoveFermilabURLs(SearchCheckDo): - query = "urls.value:http://lss.fnal.gov/cgi-bin/find_paper.pl* OR urls.value:https://lss.fnal.gov/cgi-bin/find_paper.pl*" + query = ( + "urls.value:http://lss.fnal.gov/cgi-bin/find_paper.pl* OR" + " urls.value:https://lss.fnal.gov/cgi-bin/find_paper.pl*" + ) @staticmethod def check(record, logger, state): @@ -197,7 +200,10 @@ def do(record, logger, state): class HideElsevierFulltext(SearchCheckDo): """Hide fulltexts from Elsevier that have been incorrectly set as non-hidden.""" - query = "(jy 2013 or 2014 or 2015) and documents.filename:'xml' and (arxiv_eprints.value:* or not documents.hidden:true)" + query = ( + "(jy 2013 or 2014 or 2015) and documents.filename:'xml' and" + " (arxiv_eprints.value:* or not documents.hidden:true)" + ) @staticmethod def check(record, logger, state): diff --git a/backend/inspirehep/curation/utils.py b/backend/inspirehep/curation/utils.py index 18e299126f..89d0af1013 100644 --- a/backend/inspirehep/curation/utils.py +++ b/backend/inspirehep/curation/utils.py @@ -265,7 +265,11 @@ def find_unambiguous_affiliation(result, wf_id): ) if matched_aff: message_payload = {"literature recid": matched_author["control_number"]} - message = f"Found matching affiliation, literature recid: {matched_author['control_number']}, raw_affiliations: {matched_author_raw_affs}, matched affiliations: {matched_aff}" + message = ( + "Found matching affiliation, literature recid:" + f" {matched_author['control_number']}, raw_affiliations:" + f" {matched_author_raw_affs}, matched affiliations: {matched_aff}" + ) if wf_id: message += f" workflow_id: {wf_id}" LOGGER.info("Found matching affiliation", message_payload) diff --git a/backend/inspirehep/disambiguation/cli.py b/backend/inspirehep/disambiguation/cli.py index 54be3477ee..f8ddeb7917 100644 --- a/backend/inspirehep/disambiguation/cli.py +++ b/backend/inspirehep/disambiguation/cli.py @@ -162,21 +162,30 @@ def _send_celery_group_disambiguation_task(uuids, batch_size): @click.option( "--total-records", type=int, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) @click.option( "--indexing-queue-limit", type=int, default=MAX_INDEXER_QUEUE_LEN, show_default=True, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) @click.option( "--disambiguation-queue-limit", type=int, default=MAX_DISAMBIGUATION_QUEUE_LEN, show_default=True, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) def disambiguate_all_not_disambiguated( celery_batch_size, total_records, indexing_queue_limit, disambiguation_queue_limit diff --git a/backend/inspirehep/editor/authorlist_utils.py b/backend/inspirehep/editor/authorlist_utils.py index 19aba955a8..f5e097a425 100644 --- a/backend/inspirehep/editor/authorlist_utils.py +++ b/backend/inspirehep/editor/authorlist_utils.py @@ -373,7 +373,7 @@ def create_authors(text): else: # authors = parse_blocks(text_blocks) raise ValueError( - "Authors grouped by affiliation? - Comming soon." "Or too many empty lines." + "Authors grouped by affiliation? - Comming soon.Or too many empty lines." ) if warnings: diff --git a/backend/inspirehep/editor/editor_soft_lock.py b/backend/inspirehep/editor/editor_soft_lock.py index d8e20449a1..dcd41016eb 100644 --- a/backend/inspirehep/editor/editor_soft_lock.py +++ b/backend/inspirehep/editor/editor_soft_lock.py @@ -72,9 +72,15 @@ def prepare_editor_lock_api_payload(self): ] ).strip(", ") if existing_user_locks: - editor_user_lock_msg = f"Record opened by {existing_user_locks} Their modifications aren't saved yet, they (or yours) might get lost." + editor_user_lock_msg = ( + f"Record opened by {existing_user_locks} Their modifications aren't" + " saved yet, they (or yours) might get lost." + ) payload["user_locks"] = editor_user_lock_msg elif existing_task_locks: - editor_task_lock_msg = f"Scheduled tasks: {existing_task_locks}. Your modifications might get lost" + editor_task_lock_msg = ( + f"Scheduled tasks: {existing_task_locks}. Your modifications might get" + " lost" + ) payload["task_locks"] = editor_task_lock_msg return payload diff --git a/backend/inspirehep/editor/errors.py b/backend/inspirehep/editor/errors.py index 94e7e03abf..10cbd94a31 100644 --- a/backend/inspirehep/editor/errors.py +++ b/backend/inspirehep/editor/errors.py @@ -9,7 +9,10 @@ class EditorRevertToRevisionError(RESTException): code = 400 - description = "Something went wrong while reverting to the previous revision, please try again later." + description = ( + "Something went wrong while reverting to the previous revision, please try" + " again later." + ) class EditorGetRevisionError(RESTException): diff --git a/backend/inspirehep/editor/views.py b/backend/inspirehep/editor/views.py index 96de49879b..8285d6d30d 100644 --- a/backend/inspirehep/editor/views.py +++ b/backend/inspirehep/editor/views.py @@ -390,7 +390,8 @@ def normalize_affiliations_for_authors(parsed_authors): if normalized_affiliation: author["affiliations"] = normalized_affiliation LOGGER.info( - "Found ambiguous affiliations for raw affiliations, skipping affiliation linking.", + "Found ambiguous affiliations for raw affiliations, skipping affiliation" + " linking.", ambiguous_affiliations=normalized_affiliations_result["ambiguous_affiliations"], ) return parsed_authors diff --git a/backend/inspirehep/hal/tasks.py b/backend/inspirehep/hal/tasks.py index e335dc701d..f1dd871d00 100644 --- a/backend/inspirehep/hal/tasks.py +++ b/backend/inspirehep/hal/tasks.py @@ -83,10 +83,9 @@ def _hal_push(record): hal_id = hal_value[0] if hal_value else "" lock_name = f"hal:{record['control_number']}" with distributed_lock(lock_name, blocking=True): - if hal_id: - receipt = _hal_update(tei, hal_id, record) - else: - receipt = _hal_create(tei, record) + receipt = ( + _hal_update(tei, hal_id, record) if hal_id else _hal_create(tei, record) + ) if receipt and receipt.id != hal_id: _write_hal_id_to_record(record, receipt.id) return receipt diff --git a/backend/inspirehep/hepdata/cli.py b/backend/inspirehep/hepdata/cli.py index 96c7188215..4ee14beb02 100644 --- a/backend/inspirehep/hepdata/cli.py +++ b/backend/inspirehep/hepdata/cli.py @@ -28,7 +28,10 @@ def hepdata(): "-s", "since", default=None, - help="Date from when hepdata should be harvested. If not provided the date from a day before would be used.", + help=( + "Date from when hepdata should be harvested. If not provided the date from a" + " day before would be used." + ), ) @with_appcontext def harvest(since): @@ -37,7 +40,8 @@ def harvest(since): since = datetime.strptime(since, "%Y-%m-%d").date() except ValueError as e: raise ValueError( - f"`since`: {since} is in wrong format. Should be in ISO format: YYYY-MM-DD." + f"`since`: {since} is in wrong format. Should be in ISO format:" + " YYYY-MM-DD." ) from e else: since = (datetime.now() - timedelta(1)).strftime("%Y-%m-%d") diff --git a/backend/inspirehep/indexer/base.py b/backend/inspirehep/indexer/base.py index bd09b442b6..5a9a86770e 100644 --- a/backend/inspirehep/indexer/base.py +++ b/backend/inspirehep/indexer/base.py @@ -26,12 +26,12 @@ class InspireRecordIndexer(RecordIndexer): def _prepare_record(record, index, doc_type="_doc", arguments=None, **kwargs): from inspirehep.records.api import LiteratureRecord - if current_app.config["FEATURE_FLAG_ENABLE_FULLTEXT"] and isinstance( - record, LiteratureRecord - ): - data = record.serialize_for_es_with_fulltext() - else: - data = record.serialize_for_es() + data = ( + record.serialize_for_es_with_fulltext() + if current_app.config["FEATURE_FLAG_ENABLE_FULLTEXT"] + and isinstance(record, LiteratureRecord) + else record.serialize_for_es() + ) before_record_index.send( current_app._get_current_object(), json=data, diff --git a/backend/inspirehep/indexer/cli.py b/backend/inspirehep/indexer/cli.py index 3c8865d5ad..3bac48e38f 100644 --- a/backend/inspirehep/indexer/cli.py +++ b/backend/inspirehep/indexer/cli.py @@ -43,7 +43,10 @@ "set": { "description": "Set '_error.message'", "field": "_ingest._value._error.message", - "value": "Fulltext indexing failed with message {{ _ingest.on_failure_message }}", + "value": ( + "Fulltext indexing failed with message {{" + " _ingest.on_failure_message }}" + ), "override": True, } } @@ -107,15 +110,19 @@ def dispatch_indexing_task(items, batch_size, queue_name): "-p", "--pidtype", multiple=True, - help="Reindex only the specified PIDs. " - 'Allowed values are "lit", "con", "dat", "exp", "jou", "aut", "job", "ins", "sem".', + help=( + 'Reindex only the specified PIDs. Allowed values are "lit", "con", "dat",' + ' "exp", "jou", "aut", "job", "ins", "sem".' + ), ) @click.option( "-id", "--pid", nargs=2, - help="The pid-type and pid-value of the record to reindex. " - "Example `reindex -id lit 1234.`", + help=( + "The pid-type and pid-value of the record to reindex. " + "Example `reindex -id lit 1234.`" + ), show_default=True, ) @click.option( @@ -200,7 +207,8 @@ def reindex_records( pidtypes = set(pidtype) if not pidtypes <= allowed_pids: raise ValueError( - f"PIDs {pidtypes.difference(allowed_pids)} are not a subset of {allowed_pids}." + f"PIDs {pidtypes.difference(allowed_pids)} are not a subset of" + f" {allowed_pids}." ) if all: pidtypes = allowed_pids @@ -265,14 +273,19 @@ def _finished_tasks_count(): number_of_failures=failures_count, ) click.secho( - f"Reindex completed!\n{successes_count} succeeded\n{failures_count} failed\n{len(batch_errors)} entire batches failed", + "Reindex" + f" completed!\n{successes_count} succeeded\n{failures_count} failed\n{len(batch_errors)} entire" + " batches failed", fg=color, ) @index.command( "remap", - help="(Inspire) Remaps specified indexes. Removes all data from index during this process.", + help=( + "(Inspire) Remaps specified indexes. Removes all data from index during this" + " process." + ), ) @click.option("--yes-i-know", is_flag=True) @click.option( @@ -286,14 +299,18 @@ def _finished_tasks_count(): @click.option( "--ignore-checks", is_flag=True, - help="Do not check if old index was deleted. WARNING: this may lead to one alias pointing to many indexes!", + help=( + "Do not check if old index was deleted. WARNING: this may lead to one alias" + " pointing to many indexes!" + ), ) @with_appcontext @click.pass_context def remap_indexes(ctx, yes_i_know, indexes, ignore_checks): if not yes_i_know: click.confirm( - "This operation will irreversibly remove data from selected indexes in ES, do you want to continue?", + "This operation will irreversibly remove data from selected indexes in ES," + " do you want to continue?", abort=True, ) if not indexes: @@ -315,7 +332,8 @@ def remap_indexes(ctx, yes_i_know, indexes, ignore_checks): deleted_indexes = list(current_search.delete(index_list=indexes)) if not ignore_checks and len(deleted_indexes) != len(indexes): click.echo( - f"Number of deleted indexes ({len(deleted_indexes)} is different than requested ones ({len(indexes)}", + f"Number of deleted indexes ({len(deleted_indexes)} is different than" + f" requested ones ({len(indexes)}", err=True, ) click.echo("deleted indexes %s" % [i[0] for i in deleted_indexes]) @@ -351,7 +369,8 @@ def create_aliases(ctx, yes_i_know, prefix_alias): if current_search.client.indices.exists_alias(alias_name): if not yes_i_know and not click.confirm( - f"This operation will remove current '{alias_name}' alias. Are you sure you want to continue?" + f"This operation will remove current '{alias_name}' alias. Are you sure" + " you want to continue?" ): click.echo(f"Skipping alias {alias_name}") continue @@ -388,7 +407,8 @@ def delete_indexes(ctx, yes_i_know, prefix): click.echo(f"""Found {len(indices_to_delete)} indices to delete""") for index_to_delete in indices_to_delete: if not yes_i_know and not click.confirm( - f"This operation will remove '{index_to_delete}' index. Are you sure you want to continue?" + f"This operation will remove '{index_to_delete}' index. Are you sure you" + " want to continue?" ): continue try: diff --git a/backend/inspirehep/logger/ext.py b/backend/inspirehep/logger/ext.py index b0dda24831..0735a1b72a 100644 --- a/backend/inspirehep/logger/ext.py +++ b/backend/inspirehep/logger/ext.py @@ -80,9 +80,9 @@ def init_prometheus_flask_exporter(self, app): defaults_prefix=prefix, group_by=url_rule, static_labels={ - "source": lambda: "external" - if "X-Unique-ID" in request.headers - else "internal" + "source": lambda: ( + "external" if "X-Unique-ID" in request.headers else "internal" + ) }, ) metrics_flask.init_app(app) diff --git a/backend/inspirehep/mailing/api/conferences.py b/backend/inspirehep/mailing/api/conferences.py index 3acd9f6d54..892ca70df7 100644 --- a/backend/inspirehep/mailing/api/conferences.py +++ b/backend/inspirehep/mailing/api/conferences.py @@ -40,7 +40,10 @@ def send_conference_confirmation_email(recipient, conference): sender = current_app.config["CONFERENCES_CONFIRMATION_EMAIL_ADDRESS"] - subject = f"Your conference({conference['control_number']}) has been successfully submitted!" + subject = ( + f"Your conference({conference['control_number']}) has been successfully" + " submitted!" + ) content = get_submissions_confirmation_email_html_content(conference) send_email(sender=sender, recipient=recipient, subject=subject, body=content) diff --git a/backend/inspirehep/mailing/cli.py b/backend/inspirehep/mailing/cli.py index 8441647a2b..dc9f93b634 100644 --- a/backend/inspirehep/mailing/cli.py +++ b/backend/inspirehep/mailing/cli.py @@ -25,7 +25,10 @@ def mailing(): @mailing.command( - help="Updates the Atom feed for the weekly campaign with the INSPIRE jobs posted last week." + help=( + "Updates the Atom feed for the weekly campaign with the INSPIRE jobs posted" + " last week." + ) ) @with_appcontext def update_weekly_jobs(): diff --git a/backend/inspirehep/matcher/api.py b/backend/inspirehep/matcher/api.py index 1365888d87..585137d581 100644 --- a/backend/inspirehep/matcher/api.py +++ b/backend/inspirehep/matcher/api.py @@ -275,14 +275,11 @@ def fuzzy_match_literature_data(data): """ math_ml_latex_regex = r"(|(? {redirection_pid.pid_type}:{redirection_pid.pid_value}" + self.descrtiption = ( + "You can redirect only PIDs which status are REGISTERED/REDIRECTED/DELETED" + f" and not '{original_pid.status}' and redirection can go only to correctly" + f" REGISTERED PIDs and not {redirection_pid.status}. Current redirection" + f" was requested for: {original_pid.pid_type}:{original_pid.pid_value} ->" + f" {redirection_pid.pid_type}:{redirection_pid.pid_value}" + ) class PidStatusBroken(PIDError): def __init__(self, pid, **kwargs): - self.description = f"Redirection for pid: pid_type:'{pid.pid_type}', pid_value:'{pid.pid_value}', pid status: '{pid.status}', exists but pid itself is not in REDIRECT status." + self.description = ( + f"Redirection for pid: pid_type:'{pid.pid_type}'," + f" pid_value:'{pid.pid_value}', pid status: '{pid.status}', exists but pid" + " itself is not in REDIRECT status." + ) diff --git a/backend/inspirehep/pidstore/providers/cnum.py b/backend/inspirehep/pidstore/providers/cnum.py index ca978ae059..22586c02c3 100644 --- a/backend/inspirehep/pidstore/providers/cnum.py +++ b/backend/inspirehep/pidstore/providers/cnum.py @@ -26,10 +26,11 @@ def create( cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs ): """Create a new record identifier.""" - if pid_value or "cnum" in data: - cnum = pid_value or data.get("cnum") - else: - cnum = cls.next(data) + cnum = ( + pid_value or data.get("cnum") + if pid_value or "cnum" in data + else cls.next(data) + ) if not cnum: return kwargs["pid_value"] = cnum diff --git a/backend/inspirehep/pidstore/providers/recid.py b/backend/inspirehep/pidstore/providers/recid.py index 59ec8930d0..8045d5bdbc 100644 --- a/backend/inspirehep/pidstore/providers/recid.py +++ b/backend/inspirehep/pidstore/providers/recid.py @@ -22,7 +22,9 @@ def get_next_pid_from_legacy(): """ headers = { "User-Agent": "invenio_webupload", - "Authorization": f"Bearer {current_app.config.get('BATCHUPLOADER_WEB_ROBOT_TOKEN', '')}", + "Authorization": ( + f"Bearer {current_app.config.get('BATCHUPLOADER_WEB_ROBOT_TOKEN', '')}" + ), } url = current_app.config.get("LEGACY_PID_PROVIDER") diff --git a/backend/inspirehep/pidstore/providers/texkey.py b/backend/inspirehep/pidstore/providers/texkey.py index d716369ce6..d67cf10055 100644 --- a/backend/inspirehep/pidstore/providers/texkey.py +++ b/backend/inspirehep/pidstore/providers/texkey.py @@ -145,7 +145,8 @@ def create( ) except IntegrityError: LOGGER.warning( - "Failure while creating TEXKEY. Specified TEXKEY already exists! - Retrying", + "Failure while creating TEXKEY. Specified TEXKEY already exists! -" + " Retrying", pid_value=full_texkey_generated, object_uuid=object_uuid, ) diff --git a/backend/inspirehep/records/api/authors.py b/backend/inspirehep/records/api/authors.py index 99b5304933..2e75c80fbc 100644 --- a/backend/inspirehep/records/api/authors.py +++ b/backend/inspirehep/records/api/authors.py @@ -64,7 +64,7 @@ def get_linked_author_records_uuids_if_author_changed_name(self): if uuids: LOGGER.info( f"Found {len(uuids)} papers assigned to author whose name changed. " - f"Indexing all of them.", + "Indexing all of them.", uuid=str(self.id), ) return uuids diff --git a/backend/inspirehep/records/api/base.py b/backend/inspirehep/records/api/base.py index 41c57d5dd3..ae206d24bd 100644 --- a/backend/inspirehep/records/api/base.py +++ b/backend/inspirehep/records/api/base.py @@ -170,10 +170,11 @@ def get_record(cls, record_uuid, with_deleted=False, record_version=None): Returns: Record in requested version. """ - if not record_version: - record = cls._get_record(record_uuid, with_deleted) - else: - record = cls._get_record_version(record_uuid, record_version) + record = ( + cls._get_record(record_uuid, with_deleted) + if not record_version + else cls._get_record_version(record_uuid, record_version) + ) if with_deleted is False and record.get("deleted", False): raise NoResultFound return record @@ -454,7 +455,8 @@ def delete_records_from_deleted_records(cls, data): ) except PIDDoesNotExistError: LOGGER.warning( - "This pid is missing while still is marked as deleted by another record.", + "This pid is missing while still is marked as deleted by another" + " record.", marked_by=data.get("control_number"), marked_to_delete=(pid_type, pid_value), ) @@ -596,12 +598,13 @@ def _previous_version(self): data = {} RecordMetadataVersion = version_class(RecordMetadata) try: - if isinstance(self.model, RecordMetadataVersion): - current = self.model - else: - current = self.model.versions.filter_by( + current = ( + self.model + if isinstance(self.model, RecordMetadataVersion) + else self.model.versions.filter_by( version_id=self.model.version_id ).one() + ) if current.previous: data = current.previous.json except NoResultFound: diff --git a/backend/inspirehep/records/api/mixins.py b/backend/inspirehep/records/api/mixins.py index 1262bedc82..ef993b5777 100644 --- a/backend/inspirehep/records/api/mixins.py +++ b/backend/inspirehep/records/api/mixins.py @@ -74,8 +74,8 @@ def update_authors_records_table(self): or "Literature" not in self["_collections"] ): LOGGER.info( - f"Skipping creating entries in " - f"{RecordsAuthors.__tablename__} table. Record is not literature or is deleted", + f"Skipping creating entries in {RecordsAuthors.__tablename__} table." + " Record is not literature or is deleted", recid=self.get("control_number"), uuid=str(self.id), ) @@ -598,8 +598,9 @@ def generate_entries_for_table(self): for advisor in self.get_value("advisors", []): if "record" not in advisor: LOGGER.info( - f"Skipping creating entries in " - f"{StudentsAdvisors.__tablename__} table. Advisor record is missing", + "Skipping creating entries in " + f"{StudentsAdvisors.__tablename__} table. Advisor record is" + " missing", recid=self.get("control_number"), uuid=str(self.id), ) @@ -628,7 +629,7 @@ def update_students_advisors_table(self): if self.get("deleted", False): LOGGER.info( - f"Skipping creating entries in " + "Skipping creating entries in " f"{StudentsAdvisors.__tablename__} table. Record is deleted", recid=self.get("control_number"), uuid=str(self.id), diff --git a/backend/inspirehep/records/cli.py b/backend/inspirehep/records/cli.py index 09052e6ca6..2713f80b25 100644 --- a/backend/inspirehep/records/cli.py +++ b/backend/inspirehep/records/cli.py @@ -69,8 +69,7 @@ def _create_record(data, save_to_file=False, replace_host_in_ref_url=True): db.session.commit() record.index(delay=False) message = ( - f"Record created uuid:{record.id} with " - f"pid:{control_number} has been created." + f"Record created uuid:{record.id} with pid:{control_number} has been created." ) click.echo(click.style(message, fg="green")) @@ -148,14 +147,18 @@ def importer(): multiple=True, default=[], type=str, - help="Record API url (JSON), example: https://labs.inspirehep.net/api/literature/20.", + help=( + "Record API url (JSON), example: https://labs.inspirehep.net/api/literature/20." + ), ) @click.option( "-d", "--directory", default=None, type=click.Path(exists=True), - help="Path to directory of record JSON files, example: ``data/records/literature``.", + help=( + "Path to directory of record JSON files, example: ``data/records/literature``." + ), ) @click.option( "-f", @@ -168,7 +171,10 @@ def importer(): @click.option( "-s", "--save", - help="It will save the imported records (from url) to local data folder and overwrite if they exist", + help=( + "It will save the imported records (from url) to local data folder and" + " overwrite if they exist" + ), is_flag=True, default=False, show_default=True, @@ -176,7 +182,10 @@ def importer(): @click.option( "-t", "--token", - help="Auth token to be used while importing from urls, instead of app.config['AUTHENTICATION_TOKEN']}", + help=( + "Auth token to be used while importing from urls, instead of" + " app.config['AUTHENTICATION_TOKEN']}" + ), default=None, ) @with_appcontext @@ -292,21 +301,30 @@ def populate_recid_in_record_authors_table(): @click.option( "--total-records", type=int, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) @click.option( "--indexing-queue-limit", type=int, default=10000, show_default=True, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) @click.option( "--disambiguation-queue-limit", type=int, default=10000, show_default=True, - help="Number of records to disambiguate, if not passed all records with at least one not disambiguated will be sent to the queue", + help=( + "Number of records to disambiguate, if not passed all records with at least one" + " not disambiguated will be sent to the queue" + ), ) @with_appcontext def remove_bai_from_literature_records( diff --git a/backend/inspirehep/records/config.py b/backend/inspirehep/records/config.py index ebdc58be1d..1f5f919540 100644 --- a/backend/inspirehep/records/config.py +++ b/backend/inspirehep/records/config.py @@ -85,7 +85,9 @@ def default_handler(error): "links_factory_imp": "inspirehep.records.links:inspire_detail_links_factory", "indexer_class": None, "search_type": None, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_without_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_without_aggs" + ), "default_media_type": "application/json", "record_serializers": { "application/json": "invenio_records_rest.serializers:json_v1_response" @@ -114,20 +116,42 @@ def default_handler(error): "search_index": "records-hep", "record_serializers": { "application/json": f"{INSPIRE_SERIALIZERS}:literature_json_response", - "application/vnd+inspire.record.ui+json": f"{INSPIRE_SERIALIZERS}:literature_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.ui+json": ( + f"{INSPIRE_SERIALIZERS}:literature_json_detail_response" + ), + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), "application/x-bibtex": f"{INSPIRE_SERIALIZERS}:literature_bibtex_response", - "application/vnd+inspire.latex.eu+x-latex": f"{INSPIRE_SERIALIZERS}:latex_response_eu", - "application/vnd+inspire.latex.us+x-latex": f"{INSPIRE_SERIALIZERS}:latex_response_us", - "text/vnd+inspire.html+html": f"{INSPIRE_SERIALIZERS}:literature_cv_html_response", + "application/vnd+inspire.latex.eu+x-latex": ( + f"{INSPIRE_SERIALIZERS}:latex_response_eu" + ), + "application/vnd+inspire.latex.us+x-latex": ( + f"{INSPIRE_SERIALIZERS}:latex_response_us" + ), + "text/vnd+inspire.html+html": ( + f"{INSPIRE_SERIALIZERS}:literature_cv_html_response" + ), }, "search_serializers": { - "application/json": f"{INSPIRE_SERIALIZERS}:literature_json_response_search", - "application/vnd+inspire.record.ui+json": f"{INSPIRE_SERIALIZERS}:literature_json_list_response", - "application/x-bibtex": f"{INSPIRE_SERIALIZERS}:literature_bibtex_response_search", - "text/vnd+inspire.html+html": f"{INSPIRE_SERIALIZERS}:literature_cv_html_response_search", - "application/vnd+inspire.latex.eu+x-latex": f"{INSPIRE_SERIALIZERS}:literature_latex_eu_response_search", - "application/vnd+inspire.latex.us+x-latex": f"{INSPIRE_SERIALIZERS}:literature_latex_us_response_search", + "application/json": ( + f"{INSPIRE_SERIALIZERS}:literature_json_response_search" + ), + "application/vnd+inspire.record.ui+json": ( + f"{INSPIRE_SERIALIZERS}:literature_json_list_response" + ), + "application/x-bibtex": ( + f"{INSPIRE_SERIALIZERS}:literature_bibtex_response_search" + ), + "text/vnd+inspire.html+html": ( + f"{INSPIRE_SERIALIZERS}:literature_cv_html_response_search" + ), + "application/vnd+inspire.latex.eu+x-latex": ( + f"{INSPIRE_SERIALIZERS}:literature_latex_eu_response_search" + ), + "application/vnd+inspire.latex.us+x-latex": ( + f"{INSPIRE_SERIALIZERS}:literature_latex_us_response_search" + ), }, "list_route": "/literature/", "item_route": '/literature/', @@ -163,7 +187,9 @@ def default_handler(error): LITERATURE_FACETS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "pid_type": "lit", "search_class": LiteratureAggregationsSearch, "list_route": "/literature/facets/", @@ -176,12 +202,16 @@ def default_handler(error): LITERATURE_AUTHORS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "pid_type": "lit", "list_route": "/literature/authors/", "item_route": '/literature//authors', "record_serializers": { - "application/json": f"{INSPIRE_SERIALIZERS}:literature_authors_json_response" + "application/json": ( + f"{INSPIRE_SERIALIZERS}:literature_authors_json_response" + ) }, "search_serializers": { "application/json": "invenio_records_rest.serializers:json_v1_search" @@ -213,7 +243,9 @@ def default_handler(error): "search_index": "records-authors", "record_serializers": { "application/json": INSPIRE_SERIALIZERS + ":authors_json_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":authors_json_detail_response", "application/vnd+inspire.record.control_number+json": INSPIRE_SERIALIZERS @@ -233,7 +265,9 @@ def default_handler(error): "list_route": "/authors/", "item_route": '/authors/', "record_class": "inspirehep.records.api:AuthorsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "create_permission_factory_imp": SessionSuperuserPermission, "update_permission_factory_imp": SessionCatalogerPermission, } @@ -257,7 +291,9 @@ def default_handler(error): "list_route": "/jobs/", "item_route": '/jobs/', "record_class": "inspirehep.records.api:JobsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "search_serializers": { "application/json": INSPIRE_SERIALIZERS + ":jobs_json_response_search", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS @@ -265,7 +301,9 @@ def default_handler(error): }, "record_serializers": { "application/json": INSPIRE_SERIALIZERS + ":jobs_json_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":jobs_json_detail_response", }, @@ -275,7 +313,9 @@ def default_handler(error): JOBS_FACETS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "list_route": "/jobs/facets/", "search_serializers": { "application/json": f"{INSPIRE_SERIALIZERS}:facets_json_response_search" @@ -295,7 +335,9 @@ def default_handler(error): "create_permission_factory_imp": SessionSuperuserPermission, "update_permission_factory_imp": SessionCatalogerPermission, "record_class": "inspirehep.records.api:JournalsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "suggesters": { "journal_title": { "_source": ["short_title", "journal_title", "control_number", "self"], @@ -311,7 +353,9 @@ def default_handler(error): "application/json": INSPIRE_SERIALIZERS + ":journals_json_response", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":journals_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), }, } ) @@ -328,7 +372,9 @@ def default_handler(error): "create_permission_factory_imp": SessionSuperuserPermission, "update_permission_factory_imp": SessionCatalogerPermission, "record_class": "inspirehep.records.api:ExperimentsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "search_as_you_type": { "experiment": { "_source": ["legacy_name", "control_number", "self"], @@ -360,7 +406,9 @@ def default_handler(error): "application/json": INSPIRE_SERIALIZERS + ":experiments_json_response", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":experiments_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), }, } ) @@ -369,7 +417,9 @@ def default_handler(error): EXPERIMENTS_FACETS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "list_route": "/experiments/facets/", "search_serializers": { "application/json": f"{INSPIRE_SERIALIZERS}:facets_json_response_search" @@ -387,7 +437,9 @@ def default_handler(error): "list_route": "/conferences/", "item_route": '/conferences/', "record_class": "inspirehep.records.api:ConferencesRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "suggesters": { "conference": { "_source": [ @@ -417,7 +469,9 @@ def default_handler(error): "application/json": INSPIRE_SERIALIZERS + ":conferences_json_response", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":conferences_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), }, } ) @@ -426,7 +480,9 @@ def default_handler(error): CONFERENCES_FACETS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "list_route": "/conferences/facets/", "search_serializers": { "application/json": f"{INSPIRE_SERIALIZERS}:facets_json_response_search" @@ -444,7 +500,9 @@ def default_handler(error): "list_route": "/data/", "item_route": '/data/', "record_class": "inspirehep.records.api:DataRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), } ) @@ -458,7 +516,9 @@ def default_handler(error): "list_route": "/institutions/", "item_route": '/institutions/', "record_class": "inspirehep.records.api:InstitutionsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "search_as_you_type": { "affiliation": { "_source": ["legacy_ICN", "control_number", "self"], @@ -476,7 +536,9 @@ def default_handler(error): "application/json": INSPIRE_SERIALIZERS + ":institutions_json_response", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":institutions_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), }, } ) @@ -491,7 +553,9 @@ def default_handler(error): "list_route": "/seminars/", "item_route": '/seminars/', "record_class": "inspirehep.records.api:SeminarsRecord", - "search_factory_imp": "inspirehep.search.factories.search:search_factory_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_with_aggs" + ), "search_serializers": { "application/json": INSPIRE_SERIALIZERS + ":seminars_json_response_search", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS @@ -501,7 +565,9 @@ def default_handler(error): "application/json": INSPIRE_SERIALIZERS + ":seminars_json_response", "application/vnd+inspire.record.ui+json": INSPIRE_SERIALIZERS + ":seminars_json_detail_response", - "application/vnd+inspire.record.raw+json": f"{INSPIRE_SERIALIZERS}:raw_json_detail_response", + "application/vnd+inspire.record.raw+json": ( + f"{INSPIRE_SERIALIZERS}:raw_json_detail_response" + ), }, "suggesters": { "series_name": { @@ -516,7 +582,9 @@ def default_handler(error): SEMINARS_FACETS.update( { "default_endpoint_prefix": False, - "search_factory_imp": "inspirehep.search.factories.search:search_factory_only_with_aggs", + "search_factory_imp": ( + "inspirehep.search.factories.search:search_factory_only_with_aggs" + ), "list_route": "/seminars/facets/", "search_serializers": { "application/json": f"{INSPIRE_SERIALIZERS}:facets_json_response_search" diff --git a/backend/inspirehep/records/errors.py b/backend/inspirehep/records/errors.py index 7e61af4e7f..6f69d44da9 100644 --- a/backend/inspirehep/records/errors.py +++ b/backend/inspirehep/records/errors.py @@ -57,7 +57,10 @@ class DownloadFileError(RESTException): class FileSizeExceededError(RESTException): def __init__(self, message="", **kwargs): super().__init__(**kwargs) - default_message = f"File size exceeded, maximum file size: {current_app.config['FILES_SIZE_LIMIT']} bytes" + default_message = ( + "File size exceeded, maximum file size:" + f" {current_app.config['FILES_SIZE_LIMIT']} bytes" + ) self.description = message or default_message code = 413 @@ -66,7 +69,10 @@ def __init__(self, message="", **kwargs): class UnsupportedFileError(RESTException): def __init__(self, mimetype="", **kwargs): super().__init__(**kwargs) - self.description = f"Attached file format is not supported ({mimetype}), please attach a valid file." + self.description = ( + f"Attached file format is not supported ({mimetype}), please attach a valid" + " file." + ) code = 415 @@ -77,4 +83,7 @@ class MaxResultWindowRESTError(RESTException): class CannotUndeleteRedirectedRecord(RecordsError): def __init__(self, pid_type, pid_value, **kwargs): - self.description = f"Cannot undelete redirected article ({pid_type}:{pid_value}). First remove redirection then try again." + self.description = ( + f"Cannot undelete redirected article ({pid_type}:{pid_value}). First remove" + " redirection then try again." + ) diff --git a/backend/inspirehep/records/links.py b/backend/inspirehep/records/links.py index 3556f4fc93..4a92a7761c 100644 --- a/backend/inspirehep/records/links.py +++ b/backend/inspirehep/records/links.py @@ -59,9 +59,11 @@ def inspire_search_links(links): links["prev"] = prev_url + url_fields links.update( { - format_name: f"{self_url}{url_fields}&format={format_name}" - if format_name == "json" - else f"{self_url}&format={format_name}" + format_name: ( + f"{self_url}{url_fields}&format={format_name}" + if format_name == "json" + else f"{self_url}&format={format_name}" + ) for format_name in formats } ) @@ -72,7 +74,8 @@ def inspire_search_links(links): def find_record_endpoint(pid, record_hit=None, **kwargs): """gets endpoint from pid type or from `$schema` if record_data is from search results, as all pid_types from search_result are `recid`. - If both ways of resolving endpoint are not available gets it from pid_value - additional db query""" + If both ways of resolving endpoint are not available gets it from pid_value - additional db query + """ if pid.pid_type != "recid": return current_records_rest.default_endpoint_prefixes[pid.pid_type] elif record_hit and "$schema" in record_hit.get("_source", {}): diff --git a/backend/inspirehep/records/marshmallow/literature/bibtex.py b/backend/inspirehep/records/marshmallow/literature/bibtex.py index 7fc78e9011..95b9b6d7d6 100644 --- a/backend/inspirehep/records/marshmallow/literature/bibtex.py +++ b/backend/inspirehep/records/marshmallow/literature/bibtex.py @@ -71,21 +71,25 @@ class BibTexCommonSchema(BaseSchema): document_type_map = { "article": "article", "book": "book", - "book chapter": lambda data: "article" - if get_value(data, "publication_info.journal_title") - else "inbook", + "book chapter": lambda data: ( + "article" if get_value(data, "publication_info.journal_title") else "inbook" + ), "proceedings": "proceedings", "report": "article", "note": "article", - "conference paper": lambda data: "article" - if get_value(data, "publication_info.journal_title") - else "inproceedings", - "thesis": lambda data: "article" - if get_value(data, "publication_info.journal_title") - else ( - "phdthesis" - if get_value(data, "thesis_info.degree_type") in ("phd", "habilitation") - else "mastersthesis" + "conference paper": lambda data: ( + "article" + if get_value(data, "publication_info.journal_title") + else "inproceedings" + ), + "thesis": lambda data: ( + "article" + if get_value(data, "publication_info.journal_title") + else ( + "phdthesis" + if get_value(data, "thesis_info.degree_type") in ("phd", "habilitation") + else "mastersthesis" + ) ), } diff --git a/backend/inspirehep/records/marshmallow/literature/ui.py b/backend/inspirehep/records/marshmallow/literature/ui.py index fe10b53ac4..633ef16b72 100644 --- a/backend/inspirehep/records/marshmallow/literature/ui.py +++ b/backend/inspirehep/records/marshmallow/literature/ui.py @@ -125,10 +125,11 @@ def get_is_collection_hidden(self, data): return "Literature" not in collections def get_formatted_earliest_date(self, data): - if hasattr(data, "earliest_date"): - earliest_date = data.earliest_date - else: - earliest_date = get_literature_earliest_date(data) + earliest_date = ( + data.earliest_date + if hasattr(data, "earliest_date") + else get_literature_earliest_date(data) + ) if earliest_date is None: return missing return format_date(earliest_date) diff --git a/backend/inspirehep/records/serializers/bibtex.py b/backend/inspirehep/records/serializers/bibtex.py index 972a564a3d..c1f52b330c 100644 --- a/backend/inspirehep/records/serializers/bibtex.py +++ b/backend/inspirehep/records/serializers/bibtex.py @@ -116,7 +116,10 @@ def serialize(self, pid, record, links_factory=None): recid=record.get("control_number"), error=e, ) - return f"% Bibtex generation failed for record {record.get('control_number','')}" + return ( + "% Bibtex generation failed for record" + f" {record.get('control_number','')}" + ) def serialize_search( self, pid_fetcher, search_result, links=None, item_links_factory=None diff --git a/backend/inspirehep/records/tasks.py b/backend/inspirehep/records/tasks.py index 677abf12dd..3dad84b861 100644 --- a/backend/inspirehep/records/tasks.py +++ b/backend/inspirehep/records/tasks.py @@ -132,12 +132,11 @@ def get_query_for_given_path(index, path, record_ref): record_with_reference_pid ].nested_record_fields record_recid = maybe_int(record_ref.split("/")[-1]) - if path.split(".")[0] in nested_fields: - query = Q( - "nested", path=path.split(".")[0], query=Q("match", **{path: record_recid}) - ) - else: - query = Q("match", **{path: record_recid}) + query = ( + Q("nested", path=path.split(".")[0], query=Q("match", **{path: record_recid})) + if path.split(".")[0] in nested_fields + else Q("match", **{path: record_recid}) + ) return query diff --git a/backend/inspirehep/records/utils.py b/backend/inspirehep/records/utils.py index 6c03b5607b..d301c1d640 100644 --- a/backend/inspirehep/records/utils.py +++ b/backend/inspirehep/records/utils.py @@ -83,7 +83,8 @@ def download_file_from_url(url, check_file_size=False): if check_file_size and content_length and content_length > file_size_limit: raise FileSizeExceededError( - f"Can't download file from url {download_url}. File size {content_length} is larger than the limit {file_size_limit}." + f"Can't download file from url {download_url}. File size" + f" {content_length} is larger than the limit {file_size_limit}." ) except requests.exceptions.RequestException as exc: raise DownloadFileError( @@ -169,7 +170,9 @@ def is_document_scanned(file_data): def _create_ticket_self_curation(record_control_number, record_revision_id, user_email): INSPIREHEP_URL = get_inspirehep_url() template_payload = { - "diff_url": f"{INSPIREHEP_URL}/literature/{record_control_number}/diff/{record_revision_id -1}..{record_revision_id}", + "diff_url": ( + f"{INSPIREHEP_URL}/literature/{record_control_number}/diff/{record_revision_id -1}..{record_revision_id}" + ), "user_email": user_email, } async_create_ticket_with_template.delay( diff --git a/backend/inspirehep/records/views.py b/backend/inspirehep/records/views.py index 1bcbf53412..1c75f0627e 100644 --- a/backend/inspirehep/records/views.py +++ b/backend/inspirehep/records/views.py @@ -163,7 +163,10 @@ def post(self, args): return ( jsonify( { - "message": f"workflow source for record {record_uuid} and source {source} added" + "message": ( + f"workflow source for record {record_uuid} and source" + f" {source} added" + ) } ), 200, @@ -218,7 +221,10 @@ def import_article_view(identifier): LOGGER.exception("Exception in import_article_view", exception=e) return ( jsonify( - message="There was an error when importing metadata. Please try again later or fill the form manually." + message=( + "There was an error when importing metadata. Please try again later" + " or fill the form manually." + ) ), 502, ) diff --git a/backend/inspirehep/search/aggregations.py b/backend/inspirehep/search/aggregations.py index f502a93ae3..acb590bb34 100644 --- a/backend/inspirehep/search/aggregations.py +++ b/backend/inspirehep/search/aggregations.py @@ -31,7 +31,10 @@ def hep_doc_type_aggregation(order, title="Document Type", agg_type="checkbox"): "type": agg_type, "bucket_help": { "published": { - "text": "Published papers are believed to have undergone rigorous peer review.", + "text": ( + "Published papers are believed to have undergone rigorous" + " peer review." + ), "link": "https://help.inspirehep.net/knowledge-base/faq/#faq-published", } }, diff --git a/backend/inspirehep/search/api.py b/backend/inspirehep/search/api.py index 851baa6497..934127f23e 100644 --- a/backend/inspirehep/search/api.py +++ b/backend/inspirehep/search/api.py @@ -393,16 +393,17 @@ def query_from_iq(self, query_string): :returns: Elasticsearch DSL search class """ if not is_superuser_or_cataloger_logged_in(): - if not query_string: - user_query = Q("terms", status=["open", "closed"]) - else: - user_query = Q( + user_query = ( + Q("terms", status=["open", "closed"]) + if not query_string + else Q( "bool", must=[ Q("query_string", query=query_string, default_operator="AND"), Q("terms", status=["open", "closed"]), ], ) + ) return self.query(user_query) return super().query_from_iq(query_string) diff --git a/backend/inspirehep/search/facets.py b/backend/inspirehep/search/facets.py index ffdae2a9c3..8d26091e8c 100644 --- a/backend/inspirehep/search/facets.py +++ b/backend/inspirehep/search/facets.py @@ -84,11 +84,11 @@ def must_match_all_or_missing_filter(field, missing_field_value): """Bool filter containing a list of must matches.""" def inner(values): - if missing_field_value in values: - filters = ~Q("exists", field=field) - - else: - filters = [Q("match", **{field: value}) for value in values] + filters = ( + ~Q("exists", field=field) + if missing_field_value in values + else [Q("match", **{field: value}) for value in values] + ) return Q("bool", filter=filters) @@ -381,10 +381,11 @@ def citation_summary(): "citation_count_without_self_citations", ] filters = get_filters_without_excluded(hep_filters(), excluded_filters) - if "exclude-self-citations" in request.values: - field = "citation_count_without_self_citations" - else: - field = "citation_count" + field = ( + "citation_count_without_self_citations" + if "exclude-self-citations" in request.values + else "citation_count" + ) map_script = ( "if (doc.refereed.length >0 && doc.refereed[0]) {" @@ -421,7 +422,10 @@ def flattened_refereed = []; "aggs": { "h-index": { "scripted_metric": { - "init_script": "state.citations_non_refereed = []; state.citations_refereed = []", + "init_script": ( + "state.citations_non_refereed = [];" + " state.citations_refereed = []" + ), "map_script": minify_painless(map_script), "combine_script": "return state", "reduce_script": minify_painless(reduce_script), diff --git a/backend/inspirehep/search/utils.py b/backend/inspirehep/search/utils.py index e9f3180ef2..0e3e7267ff 100644 --- a/backend/inspirehep/search/utils.py +++ b/backend/inspirehep/search/utils.py @@ -28,10 +28,11 @@ def get_facet_configuration(search_index): """ facet_name = request.values.get("facet_name") - if is_superuser_or_cataloger_logged_in(): - facet_data = current_app.config["CATALOGER_RECORDS_REST_FACETS"] - else: - facet_data = current_app.config["RECORDS_REST_FACETS"] + facet_data = ( + current_app.config["CATALOGER_RECORDS_REST_FACETS"] + if is_superuser_or_cataloger_logged_in() + else current_app.config["RECORDS_REST_FACETS"] + ) facet = facet_data.get(facet_name) or facet_data.get(search_index) diff --git a/backend/inspirehep/serializers.py b/backend/inspirehep/serializers.py index aae6ac330e..e5a24b2472 100644 --- a/backend/inspirehep/serializers.py +++ b/backend/inspirehep/serializers.py @@ -42,7 +42,8 @@ def __init__(self, schema_class=None, index_name=None, **kwargs): def preprocess_record(self, pid, record, links_factory=None, **kwargs): """Prepare a record and persistent identifier for serialization. - We are overriding it to put the actual record in the metadata instead of a dict.""" + We are overriding it to put the actual record in the metadata instead of a dict. + """ return dict( links=links_factory(pid) if links_factory else None, pid=pid, diff --git a/backend/inspirehep/snow/api.py b/backend/inspirehep/snow/api.py index 8e717b18ea..68a4d1ce75 100644 --- a/backend/inspirehep/snow/api.py +++ b/backend/inspirehep/snow/api.py @@ -332,7 +332,9 @@ def __init__( ] ): raise ValueError( - f"ticket_endpoint, third_party_ticket_endpoint and functional_element_id are required to init {self.__class__.__name__}!" + "ticket_endpoint, third_party_ticket_endpoint and" + " functional_element_id are required to init" + f" {self.__class__.__name__}!" ) def _update_ticket_with_inspire_recid(self, ticket_id, recid, assignee): diff --git a/backend/inspirehep/tools/views.py b/backend/inspirehep/tools/views.py index 129887c2c3..132337facc 100644 --- a/backend/inspirehep/tools/views.py +++ b/backend/inspirehep/tools/views.py @@ -71,13 +71,17 @@ def generate_bibliography(): if error["type"] == "ambiguous": formatted_errors.append( { - "message": f"Ambiguous reference to {error['ref']} on line {error['line']}" + "message": ( + f"Ambiguous reference to {error['ref']} on line {error['line']}" + ) } ) else: formatted_errors.append( { - "message": f"Reference to {error['ref']} not found on line {error['line']}" + "message": ( + f"Reference to {error['ref']} not found on line {error['line']}" + ) } ) diff --git a/backend/tests/helpers/factories/db/invenio_records.py b/backend/tests/helpers/factories/db/invenio_records.py index 4f2d2b52c3..34f91f8937 100644 --- a/backend/tests/helpers/factories/db/invenio_records.py +++ b/backend/tests/helpers/factories/db/invenio_records.py @@ -58,7 +58,8 @@ class TestRecordMetadata(TestBaseModel): >>> factory.record_metadata >>> factory.record_metadata.json - {'name': 'joe', '_collections': ['Literature'], 'control_number': 5, 'titles': [{'title': 'dfjMz4eAgcJS1642UvCGPSieqhnIU6DuasOBHVlHA88tGqwpHOv8Kln63wkZ'}], '$schema': 'http://localhost:5000/schemas/record/hep.json', 'document_type': ['article']} + {'name': 'joe', '_collections': ['Literature'], 'control_number': 5, + 'titles': [{'title': 'dfjMz4eAgcJS1642UvCGPSieqhnIU6DuasOBHVlHA88tGqwpHOv8Kln63wkZ'}], '$schema': 'http://localhost:5000/schemas/record/hep.json', 'document_type': ['article']} >>> type(factory.inspire_record) """ diff --git a/backend/tests/integration-async/assign/test_tasks.py b/backend/tests/integration-async/assign/test_tasks.py index 076c7906c9..e70a0c1b77 100644 --- a/backend/tests/integration-async/assign/test_tasks.py +++ b/backend/tests/integration-async/assign/test_tasks.py @@ -64,7 +64,9 @@ def assert_assign(): literature_after = LiteratureSearch.get_record_data_from_es(literature) literature_author = literature_after["authors"][0] assert literature_author["record"] == { - "$ref": f"http://localhost:5000/api/authors/{to_author['control_number']}" + "$ref": ( + f"http://localhost:5000/api/authors/{to_author['control_number']}" + ) } assert literature_author["curated_relation"] diff --git a/backend/tests/integration-async/records/indexer/test_fulltext.py b/backend/tests/integration-async/records/indexer/test_fulltext.py index 0576acea1a..da12e5296f 100644 --- a/backend/tests/integration-async/records/indexer/test_fulltext.py +++ b/backend/tests/integration-async/records/indexer/test_fulltext.py @@ -85,7 +85,9 @@ def assert_record_in_es(): "key": "arXiv:nucl-th_9310030.pdf", "filename": "arXiv:nucl-th_9310030.pdf", "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", - "text": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=", + "text": ( + "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=" + ), } ], [ diff --git a/backend/tests/integration-async/records/test_record_views.py b/backend/tests/integration-async/records/test_record_views.py index ade75ab9ff..03e3861ba2 100644 --- a/backend/tests/integration-async/records/test_record_views.py +++ b/backend/tests/integration-async/records/test_record_views.py @@ -19,7 +19,10 @@ def test_reference_diff(inspire_app, clean_celery_session): user = create_user(role="cataloger") literature_data = faker.record("lit") - raw_ref_text = '3.M. Mentink, "ATLAS circuit breakers update 18-05-20", EP Magnet RD Meeting, 2020.Show in Context' + raw_ref_text = ( + '3.M. Mentink, "ATLAS circuit breakers update 18-05-20", EP Magnet RD Meeting,' + " 2020.Show in Context" + ) literature_data.update( { "references": [ @@ -95,7 +98,10 @@ def assert_record_updated(): def test_reference_diff_multiple_references(inspire_app, clean_celery_session): user = create_user(role="cataloger") literature_data = faker.record("lit") - raw_ref_text = "[2] Jedrych, M. INSPIRE-next. A masterpiece of the modern software engineering." + raw_ref_text = ( + "[2] Jedrych, M. INSPIRE-next. A masterpiece of the modern software" + " engineering." + ) literature_data.update( { "references": [ diff --git a/backend/tests/integration-async/records/test_tasks.py b/backend/tests/integration-async/records/test_tasks.py index c930c8e959..3769cd12eb 100644 --- a/backend/tests/integration-async/records/test_tasks.py +++ b/backend/tests/integration-async/records/test_tasks.py @@ -664,7 +664,9 @@ def assert_all_records_in_es(): literature_records_from_es = list( LiteratureSearch() .query_from_iq( - query_string=f"publication_info.journal_record.$ref: {journal_record_reference}" + query_string=( + f"publication_info.journal_record.$ref: {journal_record_reference}" + ) ) .scan() ) @@ -688,7 +690,10 @@ def assert_recalculate_references_task(): literature_records_from_es = list( LiteratureSearch() .query_from_iq( - query_string=f'publication_info.journal_record.$ref: {merged_journal_record["self"]["$ref"]}' + query_string=( + 'publication_info.journal_record.$ref:' + f' {merged_journal_record["self"]["$ref"]}' + ) ) .scan() ) diff --git a/backend/tests/integration/accounts/test_decorators.py b/backend/tests/integration/accounts/test_decorators.py index 360cae0573..78a82d6dd4 100644 --- a/backend/tests/integration/accounts/test_decorators.py +++ b/backend/tests/integration/accounts/test_decorators.py @@ -51,7 +51,10 @@ def test_login_required_with_roles_unauthenticated(mock_is_authenticated, inspir decorated_func = login_required_with_roles()(func) with pytest.raises( Unauthorized, - match="401 Unauthorized: The server could not verify that you are authorized to access the URL requested.", + match=( + "401 Unauthorized: The server could not verify that you are authorized to" + " access the URL requested." + ), ): decorated_func() assert not func.called @@ -67,7 +70,10 @@ def test_login_required_with_roles_unauthorized(mock_is_authenticated, inspire_a decorated_func = login_required_with_roles(["role_a"])(func) with pytest.raises( Forbidden, - match="403 Forbidden: You don't have the permission to access the requested resource.", + match=( + "403 Forbidden: You don't have the permission to access the requested" + " resource." + ), ): decorated_func() assert not func.called diff --git a/backend/tests/integration/accounts/test_views.py b/backend/tests/integration/accounts/test_views.py index cf54d49ba0..1565a21db8 100644 --- a/backend/tests/integration/accounts/test_views.py +++ b/backend/tests/integration/accounts/test_views.py @@ -89,7 +89,8 @@ def test_login_success_redirects_to_home_if_next_url_not_in_session(inspire_app) @mock.patch("flask_login.utils._get_user") def test_sign_up_user_success(mock_current_user, inspire_app): """It's mocking current user because invenio handlers need a lot of things to - setup in order to make it properly work and we don't want to test this functinality.""" + setup in order to make it properly work and we don't want to test this functinality. + """ def return_true(): return True diff --git a/backend/tests/integration/assign/test_views.py b/backend/tests/integration/assign/test_views.py index 807e398780..7aa0c7f06f 100644 --- a/backend/tests/integration/assign/test_views.py +++ b/backend/tests/integration/assign/test_views.py @@ -548,11 +548,19 @@ def test_author_assign_papers_different_profile(mock_create_ticket, inspire_app) "snow/assign_authors_from_different_profile.html", { "to_author_names": ["Matczak, Michal"], - "from_author_url": f"http://localhost:5000/authors/{from_author_control_number}", - "to_author_url": f"http://localhost:5000/authors/{to_author_control_number}", + "from_author_url": ( + f"http://localhost:5000/authors/{from_author_control_number}" + ), + "to_author_url": ( + f"http://localhost:5000/authors/{to_author_control_number}" + ), "incompatibile_names_papers": { - f"http://localhost:5000/literature/{literature_1_control_number}": "Aad, Georges", - f"http://localhost:5000/literature/{literature_2_control_number}": "Aad, Georges", + f"http://localhost:5000/literature/{literature_1_control_number}": ( + "Aad, Georges" + ), + f"http://localhost:5000/literature/{literature_2_control_number}": ( + "Aad, Georges" + ), }, "already_claimed_papers": [ f"http://localhost:5000/literature/{literature_2_control_number}" @@ -721,11 +729,19 @@ def test_author_assign_view_claimed_with_stub_author(mock_create_ticket, inspire "snow/assign_authors_from_different_profile.html", { "to_author_names": ["Matczak, Michal"], - "from_author_url": f"http://localhost:5000/authors/{from_author['control_number']}", - "to_author_url": f"http://localhost:5000/authors/{to_author['control_number']}", + "from_author_url": ( + f"http://localhost:5000/authors/{from_author['control_number']}" + ), + "to_author_url": ( + f"http://localhost:5000/authors/{to_author['control_number']}" + ), "incompatibile_names_papers": { - f"http://localhost:5000/literature/{literature_2['control_number']}": "Aad, Georges", - f"http://localhost:5000/literature/{literature_1['control_number']}": "Aad, Georges", + f"http://localhost:5000/literature/{literature_2['control_number']}": ( + "Aad, Georges" + ), + f"http://localhost:5000/literature/{literature_1['control_number']}": ( + "Aad, Georges" + ), }, "already_claimed_papers": [], }, @@ -1086,11 +1102,19 @@ def test_assign_author_has_main_name(mock_create_ticket, inspire_app): "Malta Michaela", "Mata, Michaela", ], - "from_author_url": f"http://localhost:5000/authors/{from_author_control_number}", - "to_author_url": f"http://localhost:5000/authors/{to_author_control_number}", + "from_author_url": ( + f"http://localhost:5000/authors/{from_author_control_number}" + ), + "to_author_url": ( + f"http://localhost:5000/authors/{to_author_control_number}" + ), "incompatibile_names_papers": { - f"http://localhost:5000/literature/{literature_1_control_number}": "Aad, Georges", - f"http://localhost:5000/literature/{literature_2_control_number}": "Aad, Georges", + f"http://localhost:5000/literature/{literature_1_control_number}": ( + "Aad, Georges" + ), + f"http://localhost:5000/literature/{literature_2_control_number}": ( + "Aad, Georges" + ), }, "already_claimed_papers": [ f"http://localhost:5000/literature/{literature_2_control_number}" @@ -1200,10 +1224,16 @@ def test_assign_author_calls_create_rt_ticket_for_claiming_action_when_some_args "snow/assign_authors_from_different_profile.html", { "to_author_names": ["Viktor Axelsen", "Axelsen, Viktor"], - "from_author_url": f"http://localhost:5000/authors/{from_author['control_number']}", - "to_author_url": f"http://localhost:5000/authors/{to_author['control_number']}", + "from_author_url": ( + f"http://localhost:5000/authors/{from_author['control_number']}" + ), + "to_author_url": ( + f"http://localhost:5000/authors/{to_author['control_number']}" + ), "incompatibile_names_papers": { - f"http://localhost:5000/literature/{literature_1['control_number']}": "Aad, Georges" + f"http://localhost:5000/literature/{literature_1['control_number']}": ( + "Aad, Georges" + ) }, "already_claimed_papers": [], }, diff --git a/backend/tests/integration/curation/test_api.py b/backend/tests/integration/curation/test_api.py index 7c6d4f3a57..05f49a6fe2 100644 --- a/backend/tests/integration/curation/test_api.py +++ b/backend/tests/integration/curation/test_api.py @@ -191,7 +191,10 @@ def test_normalize_affiliations_happy_flow(inspire_app, caplog): "full_name": "Kowal, Michal", "raw_affiliations": [ { - "value": "Faculty of Physics, University of Warsaw, Pasteura 5 Warsaw" + "value": ( + "Faculty of Physics, University of Warsaw, Pasteura 5" + " Warsaw" + ) } ], }, @@ -228,7 +231,10 @@ def test_normalize_affiliations_when_authors_has_two_happy_flow(inspire_app): "full_name": "Kowal, Michal", "raw_affiliations": [ { - "value": "Faculty of Physics, University of Warsaw, Pasteura 5 Warsaw" + "value": ( + "Faculty of Physics, University of Warsaw, Pasteura 5" + " Warsaw" + ) }, {"value": "CERN, Genève, Switzerland"}, ], @@ -344,7 +350,10 @@ def test_normalize_affiliations_doesnt_return_nested_affiliations_if_using_memoi "full_name": "Li, Wei", "raw_affiliations": [ { - "value": "Institute of Theoretical Physics, Chinese Academy of Sciences, 100190 Beijing, P.R. China" + "value": ( + "Institute of Theoretical Physics, Chinese Academy of" + " Sciences, 100190 Beijing, P.R. China" + ) } ], }, @@ -353,7 +362,10 @@ def test_normalize_affiliations_doesnt_return_nested_affiliations_if_using_memoi "full_name": "Yamazaki, Masahito", "raw_affiliations": [ { - "value": "Institute of Theoretical Physics, Chinese Academy of Sciences, 100190 Beijing, P.R. China" + "value": ( + "Institute of Theoretical Physics, Chinese Academy of" + " Sciences, 100190 Beijing, P.R. China" + ) } ], }, @@ -384,7 +396,10 @@ def test_normalize_affiliations_doesnt_add_duplicated_affiliations( "raw_affiliations": [ {"value": "Warsaw U., Faculty of Physics"}, { - "value": "Warsaw U., Faculty of Mathematics, Informatics, and Mechanics" + "value": ( + "Warsaw U., Faculty of Mathematics, Informatics, and" + " Mechanics" + ) }, ], } @@ -467,7 +482,10 @@ def test_normalize_affiliations_doesnt_add_not_valid_stuff_to_affiliation( "ids": [{"schema": "INSPIRE BAI", "value": "P.J.Easter.2"}], "raw_affiliations": [ { - "value": "OzGrav: The ARC Centre of Excellence for Gravitational Wave Discovery, Clayton VIC 3800, Australia" + "value": ( + "OzGrav: The ARC Centre of Excellence for Gravitational" + " Wave Discovery, Clayton VIC 3800, Australia" + ) }, ], "signature_block": "EASTARp", @@ -503,10 +521,16 @@ def test_normalize_affiliations_assign_all_affiliations_if_one_raw_aff_in_matche "ids": [{"schema": "INSPIRE BAI", "value": "P.J.Easter.2"}], "raw_affiliations": [ { - "value": "School of Physics and Astronomy, Monash University, Vic 3800, Australia" + "value": ( + "School of Physics and Astronomy, Monash University, Vic" + " 3800, Australia" + ) }, { - "value": "OzGrav: The ARC Centre of Excellence for Gravitational Wave Discovery, Clayton VIC 3800, Australia" + "value": ( + "OzGrav: The ARC Centre of Excellence for Gravitational" + " Wave Discovery, Clayton VIC 3800, Australia" + ) }, ], "signature_block": "EASTARp", diff --git a/backend/tests/integration/editor/test_editor_views.py b/backend/tests/integration/editor/test_editor_views.py index 4156f8be20..33796bfe1f 100644 --- a/backend/tests/integration/editor/test_editor_views.py +++ b/backend/tests/integration/editor/test_editor_views.py @@ -349,11 +349,15 @@ def test_refextract_text_with_refextract_service(override_config, inspire_app): "journal_year": ["2009"], "linemarker": ["27"], "raw_ref": [ - "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki, “Instanton Calculus in Deformed N=4 Super Yang-Mills Theories,” JHEP 10 (2009) 028, arXiv:0908.4339 [hep-th]." + "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki," + " “Instanton Calculus in Deformed N=4 Super Yang-Mills" + " Theories,” JHEP 10 (2009) 028, arXiv:0908.4339" + " [hep-th]." ], "reportnumber": ["arXiv:0908.4339 [hep-th]"], "title": [ - "Instanton Calculus in Deformed N=4 Super Yang-Mills Theories" + "Instanton Calculus in Deformed N=4 Super Yang-Mills" + " Theories" ], "year": ["2009"], }, @@ -368,7 +372,12 @@ def test_refextract_text_with_refextract_service(override_config, inspire_app): content_type="application/json", data=orjson.dumps( { - "text": "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki, “Instanton Calculus in Deformed N=4 Super Yang-Mills Theories,” JHEP 10 (2009) 028, arXiv:0908.4339 [hep-th]." + "text": ( + "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki," + " “Instanton Calculus in Deformed N=4 Super Yang-Mills" + " Theories,” JHEP 10 (2009) 028, arXiv:0908.4339" + " [hep-th]." + ) } ), ) @@ -425,11 +434,15 @@ def test_refextract_url_with_refextract_service(override_config, inspire_app): "journal_year": ["2009"], "linemarker": ["27"], "raw_ref": [ - "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki, “Instanton Calculus in Deformed N=4 Super Yang-Mills Theories,” JHEP 10 (2009) 028, arXiv:0908.4339 [hep-th]." + "[27] K. Ito, H. Nakajima, T. Saka, and S. Sasaki," + " “Instanton Calculus in Deformed N=4 Super Yang-Mills" + " Theories,” JHEP 10 (2009) 028, arXiv:0908.4339" + " [hep-th]." ], "reportnumber": ["arXiv:0908.4339 [hep-th]"], "title": [ - "Instanton Calculus in Deformed N=4 Super Yang-Mills Theories" + "Instanton Calculus in Deformed N=4 Super Yang-Mills" + " Theories" ], "year": ["2009"], }, @@ -777,7 +790,10 @@ def test_authorlist_text_is_normalizing_affiliaitons(inspire_app): "full_name": "Mangiarotti, F.J.", "raw_affiliations": [ { - "value": "CERN European Organization for Nuclear Research, 1211, Geneva 23, Switzerland", + "value": ( + "CERN European Organization for Nuclear Research, 1211," + " Geneva 23, Switzerland" + ), "source": "Elsevier Ltd", } ], @@ -785,7 +801,9 @@ def test_authorlist_text_is_normalizing_affiliaitons(inspire_app): { "value": "CERN", "record": { - "$ref": "https://inspirebeta.net/api/institutions/902725" + "$ref": ( + "https://inspirebeta.net/api/institutions/902725" + ) }, } ], @@ -860,7 +878,10 @@ def test_authorlist_text_is_normalizing_multiple_affiliaitons(inspire_app): "full_name": "Mangiarotti, F.J.", "raw_affiliations": [ { - "value": "CERN European Organization for Nuclear Research, 1211, Geneva 23, Switzerland", + "value": ( + "CERN European Organization for Nuclear Research, 1211," + " Geneva 23, Switzerland" + ), "source": "Elsevier Ltd", } ], @@ -868,7 +889,9 @@ def test_authorlist_text_is_normalizing_multiple_affiliaitons(inspire_app): { "value": "CERN", "record": { - "$ref": "https://inspirebeta.net/api/institutions/902725" + "$ref": ( + "https://inspirebeta.net/api/institutions/902725" + ) }, } ], @@ -889,14 +912,19 @@ def test_authorlist_text_is_normalizing_multiple_affiliaitons(inspire_app): { "value": "Warsaw U.", "record": { - "$ref": "https://inspirebeta.net/api/institutions/903335" + "$ref": ( + "https://inspirebeta.net/api/institutions/903335" + ) }, } ], "signature_block": "BADNARa", "raw_affiliations": [ { - "value": "Faculty of Physics, University of Warsaw, ul. Pasteura 5, PL02-093 Warsaw, Poland" + "value": ( + "Faculty of Physics, University of Warsaw, ul. Pasteura" + " 5, PL02-093 Warsaw, Poland" + ) } ], } @@ -910,14 +938,7 @@ def test_authorlist_text_is_normalizing_multiple_affiliaitons(inspire_app): "/editor/authorlist/text", content_type="application/json", data=orjson.dumps( - { - "text": ( - "F. Lastname1, F.M. Otherlastname2\n" - "\n" - "1 CERN\n" - "2 Warsaw U." - ) - } + {"text": "F. Lastname1, F.M. Otherlastname2\n\n1 CERN\n2 Warsaw U."} ), ) assert response.status_code == 200 @@ -1087,7 +1108,7 @@ def test_authorlist_url(inspire_app): response = client.post( "/editor/authorlist/url", content_type="application/json", - data=orjson.dumps({"url": ("https://arxiv.org/pdf/1612.06414.pdf")}), + data=orjson.dumps({"url": "https://arxiv.org/pdf/1612.06414.pdf"}), ) assert response.status_code == 200 result = orjson.loads(response.data) @@ -1098,7 +1119,11 @@ def test_authorlist_url(inspire_app): "full_name": "Moskovic, Micha", "raw_affiliations": [ { - "value": "Università di Torino, Dipartimento di Fisica and I.N.F.N. -sezione di Torino, Via P. Giuria 1, I-10125 Torino, Italy" + "value": ( + "Università di Torino, Dipartimento di Fisica and I.N.F.N." + " -sezione di Torino, Via P. Giuria 1, I-10125 Torino," + " Italy" + ) } ], }, @@ -1143,14 +1168,20 @@ def test_authorlist_url_is_normalizing_affiliaitons(inspire_app): "full_name": "Moskovic, Micha", "raw_affiliations": [ { - "value": "Università di Torino, Dipartimento di Fisica and I.N.F.N. -sezione di Torino, Via P. Giuria 1, I-10125 Torino, Italy", + "value": ( + "Università di Torino, Dipartimento di Fisica and" + " I.N.F.N. -sezione di Torino, Via P. Giuria 1, I-10125" + " Torino, Italy" + ), } ], "affiliations": [ { "value": "Università di Torino", "record": { - "$ref": "https://inspirebeta.net/api/institutions/902725" + "$ref": ( + "https://inspirebeta.net/api/institutions/902725" + ) }, } ], @@ -1164,7 +1195,7 @@ def test_authorlist_url_is_normalizing_affiliaitons(inspire_app): response = client.post( "/editor/authorlist/url", content_type="application/json", - data=orjson.dumps({"url": ("https://arxiv.org/pdf/1612.06414.pdf")}), + data=orjson.dumps({"url": "https://arxiv.org/pdf/1612.06414.pdf"}), ) assert response.status_code == 200 @@ -1174,7 +1205,11 @@ def test_authorlist_url_is_normalizing_affiliaitons(inspire_app): "full_name": "Moskovic, Micha", "raw_affiliations": [ { - "value": "Università di Torino, Dipartimento di Fisica and I.N.F.N. -sezione di Torino, Via P. Giuria 1, I-10125 Torino, Italy" + "value": ( + "Università di Torino, Dipartimento di Fisica and I.N.F.N." + " -sezione di Torino, Via P. Giuria 1, I-10125 Torino," + " Italy" + ) } ], "affiliations": [ diff --git a/backend/tests/integration/mailing/test_api_jobs.py b/backend/tests/integration/mailing/test_api_jobs.py index c6b014e10f..f115a3210e 100644 --- a/backend/tests/integration/mailing/test_api_jobs.py +++ b/backend/tests/integration/mailing/test_api_jobs.py @@ -49,9 +49,27 @@ def test_render_jobs_weekly_campaign_job_record_template_only(create_jobs): rec_3_control_number = create_jobs["job_7_days_old"]["control_number"] expected_results = [ - f'Experimental Particle Physics\n(Beijing, Inst. High Energy Phys. - Asia) [Deadline:\n2019-09-01] POSTDOC - hep-ex, physics.ins-det\n(posted 5 days ago)', - f'Nuclear and Particle Physics\n(U. Alabama, Tuscaloosa - North America) [Deadline:\n2019-08-01] POSTDOC - nucl-ex, hep-ex, physics.ins-det\n(posted 6 days ago)', - f'Experimental Particle Physics\n(Shanghai Jiaotong U., INPAC - Asia) [Deadline:\n2019-09-30] POSTDOC - astro-ph, hep-ex, hep-lat, hep-ph, nucl-ex, physics.acc-ph, physics.ins-det\n(posted 7 days ago)', + ( + 'Experimental' + " Particle Physics\n(Beijing, Inst. High Energy Phys. - Asia)" + " [Deadline:\n2019-09-01] POSTDOC - hep-ex, physics.ins-det\n(posted 5" + " days ago)" + ), + ( + 'Nuclear' + " and Particle Physics\n(U. Alabama, Tuscaloosa - North America)" + " [Deadline:\n2019-08-01] POSTDOC - nucl-ex, hep-ex," + " physics.ins-det\n(posted 6 days ago)" + ), + ( + 'Experimental' + " Particle Physics\n(Shanghai Jiaotong U., INPAC - Asia)" + " [Deadline:\n2019-09-30] POSTDOC - astro-ph, hep-ex, hep-lat, hep-ph," + " nucl-ex, physics.acc-ph, physics.ins-det\n(posted 7 days ago)" + ), ] expected_results_len = 3 assert expected_results_len == len(jobs) diff --git a/backend/tests/integration/matcher/test_api.py b/backend/tests/integration/matcher/test_api.py index 2d261b7605..056a5125d0 100644 --- a/backend/tests/integration/matcher/test_api.py +++ b/backend/tests/integration/matcher/test_api.py @@ -1002,7 +1002,10 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "_collections": ["Literature"], "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1011,7 +1014,19 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1024,7 +1039,10 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "_collections": ["Literature"], "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), }, ], "authors": [ @@ -1033,7 +1051,64 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": 'Wrong content (aNTGC) via ppZZ production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. osite-sign leptons (electrons or muons) and the other one very very incorrect decayn the charge-parity (CP)-conserving couplings CB˜W/Λ4 and CP-violating couplings CWW/Λ4, CBW/Λ4 and CBB/Λ4 achievedfakey fakesystem (pT) are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.', + "value": ( + "Wrong content (aNTGC)' + ' via ppZZ production' + " in the 2ℓ2ν final state at a 100 TeV proton-proton collider," + " FCC-hh. The realistic FCC-hh detector environments and its" + " effects taken into account in the analysis. osite-sign leptons" + " (electrons or muons) and the other one very very incorrect decayn" + " the charge-parity (CP)-conserving couplings CB˜W/Λ4' + " and CP-violating couplings CWW/Λ4,' + " CBW/Λ4' + " and CBB/Λ4' + " achievedfakey fakesystem (pT)' + ' are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.' + ), "source": "Elsevier B.V.", } ], @@ -1045,7 +1120,10 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "_collections": ["Literature"], "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), }, ], "authors": [ @@ -1054,7 +1132,68 @@ def test_fuzzy_workflow_match_without_math_ml_and_latex(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": 'This paper presents the projections on the anomalous neutral triple gauge couplings (aNTGC) via ppZZ production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings CB˜W/Λ4 and CP-violating couplings CWW/Λ4, CBW/Λ4 and CBB/Λ4 achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system (pT) are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.', + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings (aNTGC)' + ' via ppZZ production' + " in the 2ℓ2ν final state at a 100 TeV proton-proton collider," + " FCC-hh. The realistic FCC-hh detector environments and its" + " effects taken into account in the analysis. The study is carried" + " out in the mode where one Z boson decays into a pair of" + " same-flavor, opposite-sign leptons (electrons or muons) and the" + " other one decays to the two neutrinos. The new bounds on the" + " charge-parity (CP)-conserving couplings CB˜W/Λ4' + " and CP-violating couplings CWW/Λ4,' + " CBW/Λ4' + " and CBB/Λ4' + " achieved at 95% Confidence Level (C.L.) using the transverse" + " momentum of the dilepton system (pT)' + ' are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.' + ), "source": "Elsevier B.V.", } ], @@ -1076,7 +1215,10 @@ def test_workflow_matching(inspire_app): "_collections": ["Literature"], "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1085,7 +1227,19 @@ def test_workflow_matching(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1108,7 +1262,68 @@ def test_workflow_matching(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": 'This paper presents the projections on the anomalous neutral triple gauge couplings (aNTGC) via ppZZ production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings CB˜W/Λ4 and CP-violating couplings CWW/Λ4, CBW/Λ4 and CBB/Λ4 achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system (pT) are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.', + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings (aNTGC)' + ' via ppZZ production' + " in the 2ℓ2ν final state at a 100 TeV proton-proton collider," + " FCC-hh. The realistic FCC-hh detector environments and its" + " effects taken into account in the analysis. The study is carried" + " out in the mode where one Z boson decays into a pair of" + " same-flavor, opposite-sign leptons (electrons or muons) and the" + " other one decays to the two neutrinos. The new bounds on the" + " charge-parity (CP)-conserving couplings CB˜W/Λ4' + " and CP-violating couplings CWW/Λ4,' + " CBW/Λ4' + " and CBB/Λ4' + " achieved at 95% Confidence Level (C.L.) using the transverse" + " momentum of the dilepton system (pT)' + ' are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.' + ), "source": "Elsevier B.V.", } ], @@ -1123,7 +1338,10 @@ def test_workflow_matching(inspire_app): "_collections": ["Literature"], "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), }, ], "authors": [ @@ -1132,7 +1350,68 @@ def test_workflow_matching(inspire_app): "document_type": ["article"], "abstracts": [ { - "value": 'This paper presents the projections on the anomalous neutral triple gauge couplings (aNTGC) via ppZZ production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings CB˜W/Λ4 and CP-violating couplings CWW/Λ4, CBW/Λ4 and CBB/Λ4 achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system (pT) are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.', + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings (aNTGC)' + ' via ppZZ production' + " in the 2ℓ2ν final state at a 100 TeV proton-proton collider," + " FCC-hh. The realistic FCC-hh detector environments and its" + " effects taken into account in the analysis. The study is carried" + " out in the mode where one Z boson decays into a pair of" + " same-flavor, opposite-sign leptons (electrons or muons) and the" + " other one decays to the two neutrinos. The new bounds on the" + " charge-parity (CP)-conserving couplings CB˜W/Λ4' + " and CP-violating couplings CWW/Λ4,' + " CBW/Λ4' + " and CBB/Λ4' + " achieved at 95% Confidence Level (C.L.) using the transverse" + " momentum of the dilepton system (pT)' + ' are [0.042,+0.042], [0.049,+0.049], [0.048,+0.048], and [0.047,+0.047] in units of TeV−4, respectively.' + ), "source": "Elsevier B.V.", } ], @@ -1152,7 +1431,10 @@ def test_fuzzy_match_returns_control_number_if_one_match(inspire_app): record = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1160,7 +1442,19 @@ def test_fuzzy_match_returns_control_number_if_one_match(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1169,7 +1463,10 @@ def test_fuzzy_match_returns_control_number_if_one_match(inspire_app): matched_record = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1177,7 +1474,19 @@ def test_fuzzy_match_returns_control_number_if_one_match(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1193,7 +1502,10 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): record = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1201,7 +1513,19 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1210,7 +1534,10 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): matched_record = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1218,7 +1545,19 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], @@ -1226,7 +1565,10 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): matched_record_2 = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -1234,7 +1576,19 @@ def test_fuzzy_match_returns_control_numbers_if_multiple_matches(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], diff --git a/backend/tests/integration/matcher/test_views.py b/backend/tests/integration/matcher/test_views.py index 2e484a5d61..6d47933589 100644 --- a/backend/tests/integration/matcher/test_views.py +++ b/backend/tests/integration/matcher/test_views.py @@ -151,7 +151,10 @@ def test_fuzzy_match(inspire_app): record_data = { "titles": [ { - "title": "Search for the limits on anomalous neutral triple gauge couplings via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh", + "title": ( + "Search for the limits on anomalous neutral triple gauge couplings" + " via ZZ production in the $\\ell\\ell\\nu\\nu$ channel at FCC-hh" + ), } ], "authors": [ @@ -159,7 +162,19 @@ def test_fuzzy_match(inspire_app): ], "abstracts": [ { - "value": "This paper presents the projections on the anomalous neutral triple gauge couplings via production in the 2ℓ2ν final state at a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh detector environments and its effects taken into account in the analysis. The study is carried out in the mode where one Z boson decays into a pair of same-flavor, opposite-sign leptons (electrons or muons) and the other one decays to the two neutrinos. The new bounds on the charge-parity (CP)-conserving couplings and CP-violating couplings and achieved at 95% Confidence Level (C.L.) using the transverse momentum of the dilepton system, respectively.", + "value": ( + "This paper presents the projections on the anomalous neutral" + " triple gauge couplings via production in the 2ℓ2ν final state at" + " a 100 TeV proton-proton collider, FCC-hh. The realistic FCC-hh" + " detector environments and its effects taken into account in the" + " analysis. The study is carried out in the mode where one Z boson" + " decays into a pair of same-flavor, opposite-sign leptons" + " (electrons or muons) and the other one decays to the two" + " neutrinos. The new bounds on the charge-parity (CP)-conserving" + " couplings and CP-violating couplings and achieved at 95%" + " Confidence Level (C.L.) using the transverse momentum of the" + " dilepton system, respectively." + ), "source": "Elsevier B.V.", } ], diff --git a/backend/tests/integration/orcid/test_orcid_domain_models.py b/backend/tests/integration/orcid/test_orcid_domain_models.py index 6846fb9dd1..9b109a8c46 100644 --- a/backend/tests/integration/orcid/test_orcid_domain_models.py +++ b/backend/tests/integration/orcid/test_orcid_domain_models.py @@ -214,7 +214,10 @@ def test_push_new_work_invalid_data_token(self): def test_push_new_work_invalid_data_xml(self): # Note: the recorded cassette returns (magically) a proper error. pusher = domain_models.OrcidPusher(self.orcid, self.recid, self.oauth_token) - data = b'' + data = ( + b'' + ) invalid_xml = etree.fromstringlist([data]) with ( pytest.raises(exceptions.InputDataInvalidException), diff --git a/backend/tests/integration/orcid/test_orcid_tasks_orcid_push.py b/backend/tests/integration/orcid/test_orcid_tasks_orcid_push.py index b6551adb6c..fcee6fd62e 100644 --- a/backend/tests/integration/orcid/test_orcid_tasks_orcid_push.py +++ b/backend/tests/integration/orcid/test_orcid_tasks_orcid_push.py @@ -294,7 +294,13 @@ def test_push_new_work_moved_permanently_orcid_account_exception( ): exc = MovedPermanentlyException() exc.args = ( - "{'response-code': 301, 'developer-message': '301 Moved Permanently: This account is deprecated. Please refer to account: https://qa.orcid.org/0000-0003-1134-6827. ORCID https://qa.orcid.org/0000-1111-0000-0000', 'user-message': 'The resource was not found.'", + ( + "{'response-code': 301, 'developer-message': '301 Moved Permanently:" + " This account is deprecated. Please refer to account:" + " https://qa.orcid.org/0000-0003-1134-6827. ORCID" + " https://qa.orcid.org/0000-1111-0000-0000', 'user-message': 'The" + " resource was not found.'" + ), ) self._patcher = mock.patch( "inspirehep.orcid.domain_models.OrcidPusher._post_or_put_work" diff --git a/backend/tests/integration/records/api/test_api_base.py b/backend/tests/integration/records/api/test_api_base.py index 517e864817..88125205d4 100644 --- a/backend/tests/integration/records/api/test_api_base.py +++ b/backend/tests/integration/records/api/test_api_base.py @@ -743,7 +743,11 @@ def test_deleted_record_from_legacy_is_created_with_obj_uuid_and_recid(inspire_a "collaboration": {"curated_relation": False, "value": "GAMBIT"}, "long_name": "GAMBIT : Global And Modular BSM Inference Tool", "inspire_classification": ["Non-experimental|Simulation tools"], - "description": "GAMBIT is a global fitting code for generic Beyond the Standard Model theories, designed to allow fast and easy definition of new models, observables, likelihoods, scanners and backend physics codes.", + "description": ( + "GAMBIT is a global fitting code for generic Beyond the Standard Model" + " theories, designed to allow fast and easy definition of new models," + " observables, likelihoods, scanners and backend physics codes." + ), "legacy_name": "GAMBIT", "experiment": {"value": "GAMBIT", "short_name": "GAMBIT"}, "$schema": "https://inspirebeta.net/schemas/records/experiments.json", diff --git a/backend/tests/integration/records/api/test_api_literature.py b/backend/tests/integration/records/api/test_api_literature.py index 4a19bed461..32d0c88b9d 100644 --- a/backend/tests/integration/records/api/test_api_literature.py +++ b/backend/tests/integration/records/api/test_api_literature.py @@ -445,9 +445,26 @@ def test_dump_for_es_adds_latex_and_bibtex_displays(inspire_app): data = faker.record("lit", data=additional_fields) record = LiteratureRecord.create(data) dump = record.serialize_for_es() - expected_latex_eu_display = "%\\cite{a123bx}\n\\bibitem{a123bx}\nF.~Castle \\textit{et al.} [LHCb],\n%``Jessica Jones,''\nPhys. Rev. A \\textbf{58} (2014), 500-593\ndoi:10.1088/1361-6633/aa5514\n[arXiv:1607.06746 [hep-th]].\n%0 citations counted in INSPIRE as of 19 Dec 1994" - expected_latex_us_display = "%\\cite{a123bx}\n\\bibitem{a123bx}\nF.~Castle \\textit{et al.} [LHCb],\n%``Jessica Jones,''\nPhys. Rev. A \\textbf{58}, 500-593 (2014)\ndoi:10.1088/1361-6633/aa5514\n[arXiv:1607.06746 [hep-th]].\n%0 citations counted in INSPIRE as of 19 Dec 1994" - expected_bibtex_display = '@article{a123bx,\n author = "Castle, Frank and Smith, John and Black, Joe Jr. and Jimmy",\n collaboration = "LHCb",\n title = "{Jessica Jones}",\n eprint = "1607.06746",\n archivePrefix = "arXiv",\n primaryClass = "hep-th",\n reportNumber = "DESY-17-036",\n doi = "10.1088/1361-6633/aa5514",\n journal = "Phys. Rev. A",\n volume = "58",\n pages = "500--593",\n year = "2014"\n}\n' + expected_latex_eu_display = ( + "%\\cite{a123bx}\n\\bibitem{a123bx}\nF.~Castle \\textit{et al.}" + " [LHCb],\n%``Jessica Jones,''\nPhys. Rev. A \\textbf{58} (2014)," + " 500-593\ndoi:10.1088/1361-6633/aa5514\n[arXiv:1607.06746 [hep-th]].\n%0" + " citations counted in INSPIRE as of 19 Dec 1994" + ) + expected_latex_us_display = ( + "%\\cite{a123bx}\n\\bibitem{a123bx}\nF.~Castle \\textit{et al.}" + " [LHCb],\n%``Jessica Jones,''\nPhys. Rev. A \\textbf{58}, 500-593" + " (2014)\ndoi:10.1088/1361-6633/aa5514\n[arXiv:1607.06746 [hep-th]].\n%0" + " citations counted in INSPIRE as of 19 Dec 1994" + ) + expected_bibtex_display = ( + '@article{a123bx,\n author = "Castle, Frank and Smith, John and Black, Joe' + ' Jr. and Jimmy",\n collaboration = "LHCb",\n title = "{Jessica' + ' Jones}",\n eprint = "1607.06746",\n archivePrefix = "arXiv",\n ' + ' primaryClass = "hep-th",\n reportNumber = "DESY-17-036",\n doi =' + ' "10.1088/1361-6633/aa5514",\n journal = "Phys. Rev. A",\n volume =' + ' "58",\n pages = "500--593",\n year = "2014"\n}\n' + ) assert expected_latex_eu_display == dump["_latex_eu_display"] assert expected_latex_us_display == dump["_latex_us_display"] assert expected_bibtex_display == dump["_bibtex_display"] @@ -1121,7 +1138,9 @@ def test_adding_record_with_documents_with_full_url_without_original_url( "source": "arxiv", "key": expected_document_key, "url": current_s3_instance.get_public_url(expected_document_key), - "original_url": "http://inspirehep.net/record/863300/files/fermilab-pub-10-255-e.pdf", + "original_url": ( + "http://inspirehep.net/record/863300/files/fermilab-pub-10-255-e.pdf" + ), "filename": "file1.pdf", } ] @@ -1405,13 +1424,17 @@ def test_literature_updates_refs_to_known_conferences(inspire_app): { "cnum": con1["cnum"], "conference_record": { - "$ref": f"http://localhost:5000/api/conferences/{con1['control_number']}" + "$ref": ( + f"http://localhost:5000/api/conferences/{con1['control_number']}" + ) }, }, { "cnum": con2["cnum"], "conference_record": { - "$ref": f"http://localhost:5000/api/conferences/{con2['control_number']}" + "$ref": ( + f"http://localhost:5000/api/conferences/{con2['control_number']}" + ) }, }, ] diff --git a/backend/tests/integration/records/serializers/json/test_conferences.py b/backend/tests/integration/records/serializers/json/test_conferences.py index 9889c5548c..0acdbaa92d 100644 --- a/backend/tests/integration/records/serializers/json/test_conferences.py +++ b/backend/tests/integration/records/serializers/json/test_conferences.py @@ -239,7 +239,9 @@ def test_conferences_detail_links(inspire_app): expected_status_code = 200 record = create_record("con") expected_links = { - "json": f"http://localhost:5000/conferences/{record['control_number']}?format=json" + "json": ( + f"http://localhost:5000/conferences/{record['control_number']}?format=json" + ) } with inspire_app.test_client() as client: response = client.get(f"/conferences/{record['control_number']}") diff --git a/backend/tests/integration/records/serializers/json/test_experiments.py b/backend/tests/integration/records/serializers/json/test_experiments.py index f874cdc65f..c938bfcfc1 100644 --- a/backend/tests/integration/records/serializers/json/test_experiments.py +++ b/backend/tests/integration/records/serializers/json/test_experiments.py @@ -287,7 +287,9 @@ def test_experiments_detail_links(inspire_app): expected_status_code = 200 record = create_record("exp") expected_links = { - "json": f"http://localhost:5000/experiments/{record['control_number']}?format=json" + "json": ( + f"http://localhost:5000/experiments/{record['control_number']}?format=json" + ) } with inspire_app.test_client() as client: response = client.get(f"/experiments/{record['control_number']}") diff --git a/backend/tests/integration/records/serializers/json/test_institutions.py b/backend/tests/integration/records/serializers/json/test_institutions.py index 870c60c1ea..00174b2c6e 100644 --- a/backend/tests/integration/records/serializers/json/test_institutions.py +++ b/backend/tests/integration/records/serializers/json/test_institutions.py @@ -309,7 +309,9 @@ def test_institutions_detail_links(inspire_app): expected_status_code = 200 record = create_record("ins") expected_links = { - "json": f"http://localhost:5000/institutions/{record['control_number']}?format=json" + "json": ( + f"http://localhost:5000/institutions/{record['control_number']}?format=json" + ) } with inspire_app.test_client() as client: response = client.get(f"/institutions/{record['control_number']}") diff --git a/backend/tests/integration/records/serializers/json/test_jobs.py b/backend/tests/integration/records/serializers/json/test_jobs.py index b0bc9a1604..4d5138bf02 100644 --- a/backend/tests/integration/records/serializers/json/test_jobs.py +++ b/backend/tests/integration/records/serializers/json/test_jobs.py @@ -261,7 +261,9 @@ def test_jobs_detail_serialize_experiment_with_referenced_record(inspire_app): { "name": "LIGO", "record": { - "$ref": f"http://localhost:5000/api/experiments/{rec_data_control_number}" + "$ref": ( + f"http://localhost:5000/api/experiments/{rec_data_control_number}" + ) }, } ] diff --git a/backend/tests/integration/records/serializers/json/test_literature.py b/backend/tests/integration/records/serializers/json/test_literature.py index 2ca7c9d8ba..d9bf33cdf7 100644 --- a/backend/tests/integration/records/serializers/json/test_literature.py +++ b/backend/tests/integration/records/serializers/json/test_literature.py @@ -800,7 +800,9 @@ def test_literature_detail_serializes_conference_info(inspire_app): "acronyms": ["SAIP2016"], "titles": [ { - "title": "61st Annual Conference of the South African Institute of Physics" + "title": ( + "61st Annual Conference of the South African Institute of Physics" + ) } ], "urls": [ @@ -840,7 +842,10 @@ def test_literature_detail_serializes_conference_info(inspire_app): "page_start": "512", "titles": [ { - "title": "61st Annual Conference of the South African Institute of Physics" + "title": ( + "61st Annual Conference of the South African Institute of" + " Physics" + ) } ], } @@ -1357,7 +1362,9 @@ def test_literature_json_with_fields_filtering(inspire_app): { "full_name": "Doe, John1", "record": { - "$ref": f'https://localhost:5000/api/authors/{aut["control_number"]}' + "$ref": ( + f'https://localhost:5000/api/authors/{aut["control_number"]}' + ) }, } ], @@ -1398,7 +1405,9 @@ def test_literature_json_with_fields_filtering_ignores_wrong_fields(inspire_app) { "full_name": "Doe, John1", "record": { - "$ref": f'https://localhost:5000/api/authors/{aut["control_number"]}' + "$ref": ( + f'https://localhost:5000/api/authors/{aut["control_number"]}' + ) }, } ], diff --git a/backend/tests/integration/records/serializers/test_bibtex.py b/backend/tests/integration/records/serializers/test_bibtex.py index f0eabddb3a..9c0e36c0f8 100644 --- a/backend/tests/integration/records/serializers/test_bibtex.py +++ b/backend/tests/integration/records/serializers/test_bibtex.py @@ -57,7 +57,11 @@ def test_bibtex_returns_all_expected_fields_for_conference_papers(inspire_app): record_control_number = record["control_number"] expected_status_code = 200 - expected_result = '@inproceedings{Smith:2019abc,\n author = "Rossi, Maria",\n editor = "Smith, John",\n booktitle = "{This is the parent conference title}",\n title = "{This is a conference paper title}"\n}\n' + expected_result = ( + '@inproceedings{Smith:2019abc,\n author = "Rossi, Maria",\n editor =' + ' "Smith, John",\n booktitle = "{This is the parent conference title}",\n ' + ' title = "{This is a conference paper title}"\n}\n' + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -97,7 +101,11 @@ def test_bibtex_returns_all_expected_fields_for_book_chapters(inspire_app): record_control_number = record["control_number"] expected_status_code = 200 - expected_result = '@inbook{Smith:2019abc,\n author = "Rossi, Maria",\n editor = "Smith, John",\n booktitle = "{This is the parent book title}",\n title = "{This is a book chapter title}"\n}\n' + expected_result = ( + '@inbook{Smith:2019abc,\n author = "Rossi, Maria",\n editor = "Smith,' + ' John",\n booktitle = "{This is the parent book title}",\n title =' + ' "{This is a book chapter title}"\n}\n' + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -119,12 +127,12 @@ def test_bibtex_search(inspire_app): expected_status_code = 200 expected_result_1 = ( f"@article{{{rec1['control_number']},\n" - ' title = "{This is a title.}"\n' + " title = \"{This is a title.}\"\n" "}\n" ) expected_result_2 = ( f"@article{{{rec2['control_number']},\n" - ' title = "{Yet another title.}"\n' + " title = \"{Yet another title.}\"\n" "}\n" ) with inspire_app.test_client() as client: @@ -158,7 +166,12 @@ def test_bibtex_encodes_non_latex_chars_in_non_verbatim_fields(inspire_app): record_control_number = record["control_number"] expected_status_code = 200 - expected_result = '@article{Gerard2020:abc,\n author = "G\\\'erard, Pawe\\l{}",\n collaboration = "DA\\ensuremath{\\Phi}NE",\n title = "{About \\ensuremath{\\gamma}-ray bursts}",\n doi = "10.1234/567_89",\n journal = "Annales H. Poincar\\\'e",\n volume = "42",\n pages = "314--486"\n}\n' + expected_result = ( + '@article{Gerard2020:abc,\n author = "G\\\'erard, Pawe\\l{}",\n ' + ' collaboration = "DA\\ensuremath{\\Phi}NE",\n title = "{About' + ' \\ensuremath{\\gamma}-ray bursts}",\n doi = "10.1234/567_89",\n journal' + ' = "Annales H. Poincar\\\'e",\n volume = "42",\n pages = "314--486"\n}\n' + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -182,13 +195,20 @@ def test_bibtex_strips_mathml(inspire_app): data = { "titles": [ { - "title": 'Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } record = create_record("lit", data=data) - expected_data = f'@article{{{record["control_number"]},\n title = "{{Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection Prospects}}"\n}}\n' + expected_data = ( + f'@article{{{record["control_number"]},\n title = "{{Inert Higgs Dark Matter' + ' for CDF II W-Boson Mass and Detection Prospects}"\n}\n' + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record['control_number']}?format=bibtex") assert response.get_data(as_text=True) == expected_data @@ -198,7 +218,11 @@ def test_bibtex_strips_mathml_with_and_in_title(inspire_app): data = { "titles": [ { - "title": 'Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } @@ -223,13 +247,22 @@ def __init__(filename="test", lineno=1, msg="text", offset=1): data = { "titles": [ { - "title": 'Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } record = create_record("lit", data=data) - expected_data = f"@article{{{record['control_number']},\n title = \"{{Inert Higgs \\& Dark Matter for CDF II \\ensuremath{{<}}math display=''inline''\\ensuremath{{>}}\\ensuremath{{<}}mi\\ensuremath{{>}}W\\ensuremath{{<}}/mi\\ensuremath{{>}}\\ensuremath{{<}}/math\\ensuremath{{>}}-Boson Mass and Detection Prospects}}\"\n}}\n" + expected_data = ( + f"@article{{{record['control_number']},\n title = \"{{Inert Higgs \\& Dark" + " Matter for CDF II \\ensuremath{<}math" + " display=''inline''\\ensuremath{>}\\ensuremath{<}mi\\ensuremath{>}W\\ensuremath{<}/mi\\ensuremath{>}\\ensuremath{<}/math\\ensuremath{>}-Boson" + " Mass and Detection Prospects}\"\n}\n" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record['control_number']}?format=bibtex") assert response.get_data(as_text=True) == expected_data diff --git a/backend/tests/integration/records/serializers/test_cv.py b/backend/tests/integration/records/serializers/test_cv.py index 3e1d49e567..b31bda4812 100644 --- a/backend/tests/integration/records/serializers/test_cv.py +++ b/backend/tests/integration/records/serializers/test_cv.py @@ -74,7 +74,9 @@ def test_cv_with_linked_and_unlinked_authors(inspire_app, shared_datadir): { "full_name": "Doe, John1", "record": { - "$ref": f'https://localhost:5000/api/authors/{aut["control_number"]}' + "$ref": ( + f'https://localhost:5000/api/authors/{aut["control_number"]}' + ) }, }, {"full_name": "Doe, John2"}, @@ -660,7 +662,11 @@ def test_cv_search_cached(inspire_app): record.update(data) record_control_number = record["control_number"] expected_status_code = 200 - expected_result = f'

Yet another title


' + expected_result = ( + "

Yet' + " another title


" + ) with inspire_app.test_client() as client: response = client.get("/literature", headers=headers) @@ -679,7 +685,11 @@ def test_literature_detail_cv_link_alias_format(inspire_app): record = create_record("lit", data=data) record_control_number = record["control_number"] expected_status_code = 200 - expected_result = f'

Yet another title


' + expected_result = ( + "

Yet' + " another title


" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record['control_number']}?format=cv") diff --git a/backend/tests/integration/records/serializers/test_latex.py b/backend/tests/integration/records/serializers/test_latex.py index 3e40ecdb2a..8f2e33eb6f 100644 --- a/backend/tests/integration/records/serializers/test_latex.py +++ b/backend/tests/integration/records/serializers/test_latex.py @@ -82,7 +82,10 @@ def test_latex_eu_do_not_show_supervisors(inspire_app): record_control_number = record["control_number"] expected_status_code = 200 - expected_result = f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~Normal,\n%``This is a title.,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + expected_result = ( + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~Normal,\n%``This" + " is a title.,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -111,7 +114,10 @@ def test_latex_us_do_not_show_supervisors(inspire_app): record_control_number = record["control_number"] expected_status_code = 200 - expected_result = f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~Normal,\n%``This is a title.,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + expected_result = ( + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~Normal,\n%``This" + " is a title.,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -366,7 +372,10 @@ def test_latex_handle_multiple_erratest_latex_handle_multiple_erratumstums(inspi ] } - expected_latex_data = b"[erratum: Phys. Rev. D \\textbf{99}, no.1, 019903 (2019); erratum: Phys. Rev. C \\textbf{97}, no.12, 019903 (2020)]" + expected_latex_data = ( + b"[erratum: Phys. Rev. D \\textbf{99}, no.1, 019903 (2019); erratum: Phys. Rev." + b" C \\textbf{97}, no.12, 019903 (2020)]" + ) record = create_record("lit", data) @@ -459,9 +468,10 @@ def test_latex_returns_limits_number_of_authors_to_10(inspire_app): record = create_record("lit", data) record_control_number = record["control_number"] expected = ( - f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n" - "A.~First, A.~Second, A.~Third, A.~Fourth, A.~Fifth, A.~Sixth, A.~Seventh, A.~Eighth, A.~Ninth and A.~Tenth, \\textit{et al.}\n" - "%``This is a title.,''\n%0 citations counted in INSPIRE as of 11 Sep 2020" + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~First," + " A.~Second, A.~Third, A.~Fourth, A.~Fifth, A.~Sixth, A.~Seventh, A.~Eighth," + " A.~Ninth and A.~Tenth, \\textit{et al.}\n%``This is a title.,''\n%0" + " citations counted in INSPIRE as of 11 Sep 2020" ) with inspire_app.test_client() as client: @@ -502,8 +512,9 @@ def test_latex_not_returns_etal_when_authors_nb_less_than_10(inspire_app): record = create_record("lit", data) record_control_number = record["control_number"] expected = ( - f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~First, A.~Second, A.~Third, A.~Fourth and A.~Fifth,\n" - "%``This is a title.,''\n%0 citations counted in INSPIRE as of 11 Sep 2020" + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\nA.~First," + " A.~Second, A.~Third, A.~Fourth and A.~Fifth,\n%``This is a title.,''\n%0" + " citations counted in INSPIRE as of 11 Sep 2020" ) with inspire_app.test_client() as client: @@ -531,7 +542,12 @@ def test_latex_encodes_non_latex_chars(inspire_app): "dois": [{"value": "10.1234/567_89"}], } record = create_record("lit", data) - expected = "%\\cite{Gerard2020:abc}\n\\bibitem{Gerard2020:abc}\nP.~G\\'erard [DA\\ensuremath{\\Phi}NE],\n%``About \\ensuremath{\\gamma}-ray bursts,''\nAnnales H. Poincar\\'e \\textbf{42}, 314\ndoi:10.1234/567\\_89\n%0 citations counted in INSPIRE as of 16 Sep 2020" + expected = ( + "%\\cite{Gerard2020:abc}\n\\bibitem{Gerard2020:abc}\nP.~G\\'erard" + " [DA\\ensuremath{\\Phi}NE],\n%``About \\ensuremath{\\gamma}-ray" + " bursts,''\nAnnales H. Poincar\\'e \\textbf{42}, 314\ndoi:10.1234/567\\_89\n%0" + " citations counted in INSPIRE as of 16 Sep 2020" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record['control_number']}?format=latex-us") @@ -564,8 +580,8 @@ def test_latex_returns_names_correctly(input_author, expected_name, inspire_app) record = create_record("lit", data) record_control_number = record["control_number"] expected = ( - f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n{expected_name}\n" - "%``This is a title.,''\n%0 citations counted in INSPIRE as of 11 Sep 2020" + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n{expected_name}\n%``This" + " is a title.,''\n%0 citations counted in INSPIRE as of 11 Sep 2020" ) with inspire_app.test_client() as client: @@ -1011,7 +1027,11 @@ def test_latex_strips_mathml(inspire_app): data = { "titles": [ { - "title": 'Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } @@ -1020,7 +1040,11 @@ def test_latex_strips_mathml(inspire_app): record_control_number = record.json["control_number"] expected_status_code = 200 - expected_result = f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert Higgs Dark Matter for CDF II W-Boson Mass and Detection Prospects,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + expected_result = ( + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert" + " Higgs Dark Matter for CDF II W-Boson Mass and Detection Prospects,''\n%0" + " citations counted in INSPIRE as of 19 Dec 1994" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) @@ -1037,14 +1061,22 @@ def test_latex_strips_mathml_with_and_in_title(inspire_app): data = { "titles": [ { - "title": 'Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } record = create_record("lit", data=data) record_control_number = record["control_number"] - expected_data = f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert Higgs \\& Dark Matter for CDF II W-Boson Mass and Detection Prospects,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + expected_data = ( + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert" + " Higgs \\& Dark Matter for CDF II W-Boson Mass and Detection Prospects,''\n%0" + " citations counted in INSPIRE as of 19 Dec 1994" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) assert response.get_data(as_text=True) == expected_data @@ -1064,13 +1096,23 @@ def __init__(filename="test", lineno=1, msg="text", offset=1): data = { "titles": [ { - "title": 'Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection Prospects' + "title": ( + "Inert Higgs & Dark Matter for CDF II W-Boson Mass and Detection' + " Prospects" + ) } ], } record = create_record("lit", data=data) record_control_number = record["control_number"] - expected_data = f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert Higgs \\& Dark Matter for CDF II \\ensuremath{{<}}math display=''inline''\\ensuremath{{>}}\\ensuremath{{<}}mi\\ensuremath{{>}}W\\ensuremath{{<}}/mi\\ensuremath{{>}}\\ensuremath{{<}}/math\\ensuremath{{>}}-Boson Mass and Detection Prospects,''\n%0 citations counted in INSPIRE as of 19 Dec 1994" + expected_data = ( + f"%\\cite{{{record_control_number}}}\n\\bibitem{{{record_control_number}}}\n%``Inert" + " Higgs \\& Dark Matter for CDF II \\ensuremath{<}math" + " display=''inline''\\ensuremath{>}\\ensuremath{<}mi\\ensuremath{>}W\\ensuremath{<}/mi\\ensuremath{>}\\ensuremath{<}/math\\ensuremath{>}-Boson" + " Mass and Detection Prospects,''\n%0 citations counted in INSPIRE as of 19" + " Dec 1994" + ) with inspire_app.test_client() as client: response = client.get(f"/literature/{record_control_number}", headers=headers) assert response.get_data(as_text=True) == expected_data diff --git a/backend/tests/integration/records/test_tasks.py b/backend/tests/integration/records/test_tasks.py index 11668d0015..e5b2da2207 100644 --- a/backend/tests/integration/records/test_tasks.py +++ b/backend/tests/integration/records/test_tasks.py @@ -159,7 +159,67 @@ def test_get_query_for_given_path_regression(inspire_app): "$schema": "https://labs.inspirehep.net/api/schemas/records/jobs.json", "regions": ["Asia"], "position": "ATLAS Postdoctoral Research Fellow at Tsung-Dao Lee Institute", - "description": '
The Particle Physics Division (PD) at Tsung-Dao Lee Institute (TDLI) and Institute for Nuclear and Particle Physics (INPAC) at Shanghai Jiao Tong University (SJTU), China invite applications for postdoctoral researcher positions to work on ATLAS experiment at LHC, CERN. We welcome highly motivated applicants who have obtained a Ph.D. degree or who are expecting one prior to starting the position, in nuclear physics, particle physics, or a related field. The initial appointment is for 2 years with possible renewal based on mutual satisfaction (up to 5 year maximum). PD@TDLI and INPAC@SJTU offer competitive salary commensurate with qualifications and subsidized housing options through the university. We will also encourage promising candidates in applying for the prestigious "Tsung-Dao Lee Postdoctoral Fellowship" and “Chung-Yao Chao Postdoctoral Fellowship” for additional benefits.

The successful candidate will participate in ATLAS experiment at CERN and with good opportunities to be based at CERN, and also has chance to travel to and work in Shanghai if needed. The appointee will be expected to make major contributions to ATLAS Run2/Run3 data analysis related to property measurements of the Higgs boson, searches for new physics beyond the Standard Model, Standard Model electroweak multi-boson physics, and top quark physics. The hardware experience with high granularity analogue/digital calorimeters, muon spectrometer, and silicon detectors will be advantageous.

TDLI is a newly established prestigious national research institute in China, initiated by Prof. Tsung-Dao Lee (University Professor Emeritus at Columbia Univ., USA; Nobel Prize in Physics 1957, Albert Einstein Award 1957), directly approved by China’s Central Government, co-funded by Ministry of Science and Technology, the Ministry of Education, the Municipal Government of Shanghai and National Science Foundation of China. Shanghai Jiao Tong University is retained and approved by the government to operate the new Institute as its contractor and trustee. The official director of the institute is Prof. Frank Wilczek (Professor of MIT, USA; Nobel Prize in Physics 2004) supporting world-class fundamental physics research in high energy physics, astrophysics and quantum physics. English is the working language at the institute. TDLI has an international working environment and provides diversified culture experiences. Non-Chinese-speaking candidates are equally highly encouraged to apply.

TDLI aims for establishing a top-notch physics research institute that is similar to the Niels Bohr Institute at Copenhagen and Institute of Advanced Studies at Princeton. The central government has strongly committed to this endeavor. The Institute aims to undertake three basic missions: 1) provides a platform to foster academic training, exchange, and collaborations for worldwide physicists; 2) hosts cutting-edge research programs on most fundamental questions in particle physics, cosmology and quantum physics with potential expansion to include other related areas such as the application of quantum mechanics to bioprocesses; 3) actively engages in general public science education.

Applicants should submit a CV, a brief research statement, a list of publications and at least three letters of recommendation to:
atlas-china-sjtu-faculty@cern.ch
Please put “ATLAS Postdoc Application: YOUR_NAME” as the identifier in the email subject.

For full consideration, applications should be received by Feb. 29, 2019. The position will remain open till filled. In case of inquiries for more info, please feel free to contact: Profs. Jun Guo, Kim Siang Khaw, Liang Li, Shu Li, Kun Liu, Weihao Wu, Haijun Yang, Ning Zhou
', + "description": ( + "
The Particle Physics Division (PD) at Tsung-Dao Lee Institute" + " (TDLI) and Institute for Nuclear and Particle" + " Physics (INPAC) at Shanghai Jiao Tong University (SJTU), China" + " invite applications for postdoctoral researcher positions to work on" + " ATLAS experiment at LHC, CERN. We welcome highly motivated applicants who" + " have obtained a Ph.D. degree or who are expecting one prior to starting" + " the position, in nuclear physics, particle physics, or a related field." + " The initial appointment is for 2 years with possible renewal based on" + " mutual satisfaction (up to 5 year maximum). PD@TDLI and INPAC@SJTU offer" + " competitive salary commensurate with qualifications and subsidized" + " housing options through the university. We will also encourage promising" + ' candidates in applying for the prestigious "Tsung-Dao Lee' + ' Postdoctoral Fellowship" and “Chung-Yao Chao Postdoctoral Fellowship”' + " for additional benefits.

The" + " successful candidate will participate in ATLAS experiment at CERN and" + " with good opportunities to be based at CERN, and also has chance" + " to travel to and work in Shanghai if needed. The appointee will be" + " expected to make major contributions to ATLAS Run2/Run3 data analysis" + " related to property measurements of the Higgs boson, searches for new" + " physics beyond the Standard Model, Standard Model electroweak multi-boson" + " physics, and top quark physics. The hardware experience with high" + " granularity analogue/digital calorimeters, muon spectrometer, and silicon" + " detectors will be advantageous.

TDLI is" + " a newly established prestigious national research institute in China," + " initiated by Prof. Tsung-Dao Lee (University Professor" + " Emeritus at Columbia Univ., USA; Nobel Prize in Physics 1957, Albert" + " Einstein Award 1957), directly approved by China’s Central Government," + " co-funded by Ministry of Science and Technology, the Ministry of" + " Education, the Municipal Government of Shanghai and National Science" + " Foundation of China. Shanghai Jiao Tong University is retained and" + " approved by the government to operate the new Institute as its contractor" + " and trustee. The official director of the institute is Prof. Frank" + " Wilczek (Professor of MIT, USA; Nobel Prize in Physics 2004) supporting" + " world-class fundamental physics research in high energy physics," + " astrophysics and quantum physics. English is the working" + " language at the institute. TDLI has an international working environment" + " and provides diversified culture experiences. Non-Chinese-speaking" + " candidates are equally highly encouraged to" + " apply.

TDLI aims for" + " establishing a top-notch physics research institute that is similar to" + " the Niels Bohr Institute at Copenhagen and Institute of Advanced Studies" + " at Princeton. The central government has strongly committed to this" + " endeavor. The Institute aims to undertake three basic" + " missions: 1) provides a platform to foster academic training, exchange," + " and collaborations for worldwide physicists; 2) hosts cutting-edge" + " research programs on most fundamental questions in particle physics," + " cosmology and quantum physics with potential expansion to include other" + " related areas such as the application of quantum mechanics to" + " bioprocesses; 3) actively engages in general public science" + " education.

Applicants should submit a" + " CV, a brief research statement, a list of publications and at least three" + " letters of recommendation" + " to:
atlas-china-sjtu-faculty@cern.ch
Please" + " put “ATLAS Postdoc Application: YOUR_NAME” as the identifier in the email" + " subject.

For full" + " consideration, applications should be received by Feb. 29, 2019. The" + " position will remain open till filled. In case of inquiries for more" + " info, please feel free to contact: Profs. Jun Guo, Kim Siang" + " Khaw, Liang Li, Shu Li, Kun Liu, Weihao Wu, Haijun Yang, Ning Zhou
" + ), "_collections": ["Jobs"], "contact_details": [ { @@ -183,7 +243,67 @@ def test_get_query_for_given_path_regression(inspire_app): "$schema": "https://labs.inspirehep.net/api/schemas/records/jobs.json", "regions": ["Asia"], "position": "ATLAS Postdoctoral Research Fellow at Pung-Dao Lee Institute", - "description": '
The Particle Physics Division (PD) at Tsung-Dao Lee Institute (TDLI) and Institute for Nuclear and Particle Physics (INPAC) at Shanghai Jiao Tong University (SJTU), China invite applications for postdoctoral researcher positions to work on ATLAS experiment at LHC, CERN. We welcome highly motivated applicants who have obtained a Ph.D. degree or who are expecting one prior to starting the position, in nuclear physics, particle physics, or a related field. The initial appointment is for 2 years with possible renewal based on mutual satisfaction (up to 5 year maximum). PD@TDLI and INPAC@SJTU offer competitive salary commensurate with qualifications and subsidized housing options through the university. We will also encourage promising candidates in applying for the prestigious "Tsung-Dao Lee Postdoctoral Fellowship" and “Chung-Yao Chao Postdoctoral Fellowship” for additional benefits.

The successful candidate will participate in ATLAS experiment at CERN and with good opportunities to be based at CERN, and also has chance to travel to and work in Shanghai if needed. The appointee will be expected to make major contributions to ATLAS Run2/Run3 data analysis related to property measurements of the Higgs boson, searches for new physics beyond the Standard Model, Standard Model electroweak multi-boson physics, and top quark physics. The hardware experience with high granularity analogue/digital calorimeters, muon spectrometer, and silicon detectors will be advantageous.

TDLI is a newly established prestigious national research institute in China, initiated by Prof. Tsung-Dao Lee (University Professor Emeritus at Columbia Univ., USA; Nobel Prize in Physics 1957, Albert Einstein Award 1957), directly approved by China’s Central Government, co-funded by Ministry of Science and Technology, the Ministry of Education, the Municipal Government of Shanghai and National Science Foundation of China. Shanghai Jiao Tong University is retained and approved by the government to operate the new Institute as its contractor and trustee. The official director of the institute is Prof. Frank Wilczek (Professor of MIT, USA; Nobel Prize in Physics 2004) supporting world-class fundamental physics research in high energy physics, astrophysics and quantum physics. English is the working language at the institute. TDLI has an international working environment and provides diversified culture experiences. Non-Chinese-speaking candidates are equally highly encouraged to apply.

TDLI aims for establishing a top-notch physics research institute that is similar to the Niels Bohr Institute at Copenhagen and Institute of Advanced Studies at Princeton. The central government has strongly committed to this endeavor. The Institute aims to undertake three basic missions: 1) provides a platform to foster academic training, exchange, and collaborations for worldwide physicists; 2) hosts cutting-edge research programs on most fundamental questions in particle physics, cosmology and quantum physics with potential expansion to include other related areas such as the application of quantum mechanics to bioprocesses; 3) actively engages in general public science education.

Applicants should submit a CV, a brief research statement, a list of publications and at least three letters of recommendation to:
atlas-china-sjtu-faculty@cern.ch
Please put “ATLAS Postdoc Application: YOUR_NAME” as the identifier in the email subject.

For full consideration, applications should be received by Feb. 29, 2019. The position will remain open till filled. In case of inquiries for more info, please feel free to contact: Profs. Jun Guo, Kim Siang Khaw, Liang Li, Shu Li, Kun Liu, Weihao Wu, Haijun Yang, Ning Zhou
', + "description": ( + "
The Particle Physics Division (PD) at Tsung-Dao Lee Institute" + " (TDLI) and Institute for Nuclear and Particle" + " Physics (INPAC) at Shanghai Jiao Tong University (SJTU), China" + " invite applications for postdoctoral researcher positions to work on" + " ATLAS experiment at LHC, CERN. We welcome highly motivated applicants who" + " have obtained a Ph.D. degree or who are expecting one prior to starting" + " the position, in nuclear physics, particle physics, or a related field." + " The initial appointment is for 2 years with possible renewal based on" + " mutual satisfaction (up to 5 year maximum). PD@TDLI and INPAC@SJTU offer" + " competitive salary commensurate with qualifications and subsidized" + " housing options through the university. We will also encourage promising" + ' candidates in applying for the prestigious "Tsung-Dao Lee' + ' Postdoctoral Fellowship" and “Chung-Yao Chao Postdoctoral Fellowship”' + " for additional benefits.

The" + " successful candidate will participate in ATLAS experiment at CERN and" + " with good opportunities to be based at CERN, and also has chance" + " to travel to and work in Shanghai if needed. The appointee will be" + " expected to make major contributions to ATLAS Run2/Run3 data analysis" + " related to property measurements of the Higgs boson, searches for new" + " physics beyond the Standard Model, Standard Model electroweak multi-boson" + " physics, and top quark physics. The hardware experience with high" + " granularity analogue/digital calorimeters, muon spectrometer, and silicon" + " detectors will be advantageous.

TDLI is" + " a newly established prestigious national research institute in China," + " initiated by Prof. Tsung-Dao Lee (University Professor" + " Emeritus at Columbia Univ., USA; Nobel Prize in Physics 1957, Albert" + " Einstein Award 1957), directly approved by China’s Central Government," + " co-funded by Ministry of Science and Technology, the Ministry of" + " Education, the Municipal Government of Shanghai and National Science" + " Foundation of China. Shanghai Jiao Tong University is retained and" + " approved by the government to operate the new Institute as its contractor" + " and trustee. The official director of the institute is Prof. Frank" + " Wilczek (Professor of MIT, USA; Nobel Prize in Physics 2004) supporting" + " world-class fundamental physics research in high energy physics," + " astrophysics and quantum physics. English is the working" + " language at the institute. TDLI has an international working environment" + " and provides diversified culture experiences. Non-Chinese-speaking" + " candidates are equally highly encouraged to" + " apply.

TDLI aims for" + " establishing a top-notch physics research institute that is similar to" + " the Niels Bohr Institute at Copenhagen and Institute of Advanced Studies" + " at Princeton. The central government has strongly committed to this" + " endeavor. The Institute aims to undertake three basic" + " missions: 1) provides a platform to foster academic training, exchange," + " and collaborations for worldwide physicists; 2) hosts cutting-edge" + " research programs on most fundamental questions in particle physics," + " cosmology and quantum physics with potential expansion to include other" + " related areas such as the application of quantum mechanics to" + " bioprocesses; 3) actively engages in general public science" + " education.

Applicants should submit a" + " CV, a brief research statement, a list of publications and at least three" + " letters of recommendation" + " to:
atlas-china-sjtu-faculty@cern.ch
Please" + " put “ATLAS Postdoc Application: YOUR_NAME” as the identifier in the email" + " subject.

For full" + " consideration, applications should be received by Feb. 29, 2019. The" + " position will remain open till filled. In case of inquiries for more" + " info, please feel free to contact: Profs. Jun Guo, Kim Siang" + " Khaw, Liang Li, Shu Li, Kun Liu, Weihao Wu, Haijun Yang, Ning Zhou
" + ), "_collections": ["Jobs"], "contact_details": [ { diff --git a/backend/tests/integration/records/views/test_views_article.py b/backend/tests/integration/records/views/test_views_article.py index 0ee58b0db7..2e31c6fcd5 100644 --- a/backend/tests/integration/records/views/test_views_article.py +++ b/backend/tests/integration/records/views/test_views_article.py @@ -152,7 +152,10 @@ def test_import_article_view_200_crossref(inspire_app): resp = client.get(f"/literature/import/{doi}") result = resp.json["data"] - expected_title = "Observation of a new particle in the search for the Standard Model Higgs boson with the ATLAS detector at the LHC" + expected_title = ( + "Observation of a new particle in the search for the Standard Model Higgs boson" + " with the ATLAS detector at the LHC" + ) assert resp.status_code == 200 assert result["title"] == expected_title assert result["doi"] == doi @@ -166,8 +169,8 @@ def test_import_doi_request_error(mock_response, inspire_app): with inspire_app.test_client() as client: resp = client.get(f"/literature/import/{doi}") - assert resp.json["message"] == ( - "There was an error when importing metadata. " + assert ( + resp.json["message"] == "There was an error when importing metadata. " "Please try again later or fill the form manually." ) assert resp.status_code == 502 diff --git a/backend/tests/integration/records/views/test_views_institutions.py b/backend/tests/integration/records/views/test_views_institutions.py index 726a74dd67..24a4883a64 100644 --- a/backend/tests/integration/records/views/test_views_institutions.py +++ b/backend/tests/integration/records/views/test_views_institutions.py @@ -121,7 +121,9 @@ def test_institutions_application_json_put_with_cataloger_logged_in(inspire_app) data=orjson.dumps( { "control_number": record_control_number, - "$schema": "http://localhost:5000/schemas/records/institutions.json", + "$schema": ( + "http://localhost:5000/schemas/records/institutions.json" + ), "_collections": ["Institutions"], } ), diff --git a/backend/tests/integration/records/views/test_views_jobs.py b/backend/tests/integration/records/views/test_views_jobs.py index 504903524f..7ddf29605f 100644 --- a/backend/tests/integration/records/views/test_views_jobs.py +++ b/backend/tests/integration/records/views/test_views_jobs.py @@ -147,7 +147,9 @@ def test_jobs_accelerator_experiments(inspire_app, datadir): { "name": "FNAL-E-0973", "record": { - "$ref": f"http://localhost:5000/api/experiments/{exp1['control_number']}" + "$ref": ( + f"http://localhost:5000/api/experiments/{exp1['control_number']}" + ) }, }, {"name": "LDMX"}, diff --git a/backend/tests/integration/records/views/test_views_literature.py b/backend/tests/integration/records/views/test_views_literature.py index d551050f1d..dacb5338aa 100644 --- a/backend/tests/integration/records/views/test_views_literature.py +++ b/backend/tests/integration/records/views/test_views_literature.py @@ -227,7 +227,9 @@ def test_literature_citations(inspire_app): "references": [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{record_control_number}" + ) } } ], @@ -269,7 +271,9 @@ def test_literature_citations_with_superseded_citing_records(inspire_app): "references": [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{record_control_number}" + ) } } ], @@ -290,7 +294,9 @@ def test_literature_citations_with_superseded_citing_records(inspire_app): "references": [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{record_control_number}" + ) } } ], @@ -335,7 +341,9 @@ def test_literature_citations_with_non_citeable_collection(inspire_app): "references": [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{record_control_number}" + ) } } ], @@ -355,7 +363,9 @@ def test_literature_citations_with_non_citeable_collection(inspire_app): "references": [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{record_control_number}" + ) } } ], diff --git a/backend/tests/integration/search/test_aggregations.py b/backend/tests/integration/search/test_aggregations.py index a3d9bc4e74..29de6f7a65 100644 --- a/backend/tests/integration/search/test_aggregations.py +++ b/backend/tests/integration/search/test_aggregations.py @@ -133,7 +133,10 @@ def test_hep_doc_type_aggregation_and_filter(inspire_app, override_config): "bucket_help": { "published": { "link": "https://help.inspirehep.net/knowledge-base/faq/#faq-published", - "text": "Published papers are believed to have undergone rigorous peer review.", + "text": ( + "Published papers are believed to have undergone rigorous" + " peer review." + ), } }, "title": "Document Type", diff --git a/backend/tests/integration/search/test_api.py b/backend/tests/integration/search/test_api.py index 12d8aec415..1a92ac904c 100644 --- a/backend/tests/integration/search/test_api.py +++ b/backend/tests/integration/search/test_api.py @@ -275,7 +275,10 @@ def test_return_record_for_publication_info_search_example_2(inspire_app): ], "titles": [ { - "title": "Phase structure and phase transition of the SU(2) Higgs model in three-dimensions" + "title": ( + "Phase structure and phase transition of the SU(2) Higgs model in" + " three-dimensions" + ) } ], } @@ -335,7 +338,10 @@ def test_return_record_for_publication_info_search_example_3(inspire_app): ], "titles": [ { - "title": "Phase structure and phase transition of the SU(2) Higgs model in three-dimensions" + "title": ( + "Phase structure and phase transition of the SU(2) Higgs model in" + " three-dimensions" + ) } ], } @@ -386,7 +392,10 @@ def test_return_record_for_publication_info_search_with_leading_zeros_in_page_ar ], "titles": [ { - "title": "Phase structure and phase transition of the SU(2) Higgs model in three-dimensions" + "title": ( + "Phase structure and phase transition of the SU(2) Higgs model in" + " three-dimensions" + ) } ], } @@ -433,7 +442,10 @@ def test_return_record_for_publication_info_search_with_old_format(inspire_app): ], "titles": [ { - "title": "Phase structure and phase transition of the SU(2) Higgs model in three-dimensions" + "title": ( + "Phase structure and phase transition of the SU(2) Higgs model in" + " three-dimensions" + ) } ], } @@ -811,9 +823,15 @@ def test_big_query_execute_without_recursion_depth_exception(inspire_app): def test_public_api_generates_correct_links_in_literature_search(inspire_app): expected_search_links = { "self": "http://localhost:5000/api/literature/?q=&size=10&page=1", - "bibtex": "http://localhost:5000/api/literature/?q=&size=10&page=1&format=bibtex", - "latex-eu": "http://localhost:5000/api/literature/?q=&size=10&page=1&format=latex-eu", - "latex-us": "http://localhost:5000/api/literature/?q=&size=10&page=1&format=latex-us", + "bibtex": ( + "http://localhost:5000/api/literature/?q=&size=10&page=1&format=bibtex" + ), + "latex-eu": ( + "http://localhost:5000/api/literature/?q=&size=10&page=1&format=latex-eu" + ), + "latex-us": ( + "http://localhost:5000/api/literature/?q=&size=10&page=1&format=latex-us" + ), "json": "http://localhost:5000/api/literature/?q=&size=10&page=1&format=json", "cv": "http://localhost:5000/api/literature/?q=&size=10&page=1&format=cv", } @@ -938,7 +956,10 @@ def test_public_api_generates_correct_links_in_conferences_search(inspire_app): @pytest.mark.xfail( - reason="Json Serializer for search is not yet configured for data collection so it's using default Invenio one." + reason=( + "Json Serializer for search is not yet configured for data collection so it's" + " using default Invenio one." + ) ) def test_public_api_generates_correct_links_in_data_search(inspire_app): expected_search_links = { @@ -1058,13 +1079,25 @@ def test_public_api_generates_correct_links_in_literature_search_with_fields( inspire_app, ): expected_search_links = { - "self": "http://localhost:5000/api/literature/?q=&size=1&page=2&fields=ids,authors", - "bibtex": "http://localhost:5000/api/literature/?q=&size=1&page=2&format=bibtex", - "latex-eu": "http://localhost:5000/api/literature/?q=&size=1&page=2&format=latex-eu", - "latex-us": "http://localhost:5000/api/literature/?q=&size=1&page=2&format=latex-us", + "self": ( + "http://localhost:5000/api/literature/?q=&size=1&page=2&fields=ids,authors" + ), + "bibtex": ( + "http://localhost:5000/api/literature/?q=&size=1&page=2&format=bibtex" + ), + "latex-eu": ( + "http://localhost:5000/api/literature/?q=&size=1&page=2&format=latex-eu" + ), + "latex-us": ( + "http://localhost:5000/api/literature/?q=&size=1&page=2&format=latex-us" + ), "json": "http://localhost:5000/api/literature/?q=&size=1&page=2&fields=ids,authors&format=json", - "prev": "http://localhost:5000/api/literature/?q=&size=1&page=1&fields=ids,authors", - "next": "http://localhost:5000/api/literature/?q=&size=1&page=3&fields=ids,authors", + "prev": ( + "http://localhost:5000/api/literature/?q=&size=1&page=1&fields=ids,authors" + ), + "next": ( + "http://localhost:5000/api/literature/?q=&size=1&page=3&fields=ids,authors" + ), "cv": "http://localhost:5000/api/literature/?q=&size=1&page=2&format=cv", } create_record("lit") @@ -1338,7 +1371,8 @@ def test_citedby_bool_query(inspire_app): rec_2 = create_record("lit") result = LiteratureSearch().query_from_iq( - f"citedby: recid {rec_1['control_number']} or citedby:recid:{rec_2['control_number']}" + f"citedby: recid {rec_1['control_number']} or" + f" citedby:recid:{rec_2['control_number']}" ) expected = { "bool": { @@ -1374,7 +1408,8 @@ def test_citedby_complex_query(inspire_app): rec_2 = create_record("lit", data={"authors": [{"full_name": "Mata"}]}) result = LiteratureSearch().query_from_iq( - f"citedby: recid {rec_1['control_number']} or citedby:recid:{rec_2['control_number']} and a Mata" + f"citedby: recid {rec_1['control_number']} or" + f" citedby:recid:{rec_2['control_number']} and a Mata" ) expected = { "bool": { @@ -1540,7 +1575,10 @@ def test_search_serializer_handles_db_exceptions(mocked_get_pid_type, inspire_ap record = { "titles": [ { - "title": "Phase structure and phase transition of the SU(2) Higgs model in three-dimensions" + "title": ( + "Phase structure and phase transition of the SU(2) Higgs model in" + " three-dimensions" + ) } ], } diff --git a/backend/tests/integration/submissions/test_submissions_views.py b/backend/tests/integration/submissions/test_submissions_views.py index bf3fe4ac69..ad8847f62d 100644 --- a/backend/tests/integration/submissions/test_submissions_views.py +++ b/backend/tests/integration/submissions/test_submissions_views.py @@ -2148,7 +2148,9 @@ def test_new_seminar_submission_with_valid_lit_record( assert seminar_record["literature_records"] == [ { "record": { - "$ref": f"http://localhost:5000/api/literature/{lit_record_control_number}" + "$ref": ( + f"http://localhost:5000/api/literature/{lit_record_control_number}" + ) } } ] diff --git a/backend/tests/integration/tools/test_views.py b/backend/tests/integration/tools/test_views.py index 09f2f36c78..6609673aa3 100644 --- a/backend/tests/integration/tools/test_views.py +++ b/backend/tests/integration/tools/test_views.py @@ -147,31 +147,107 @@ def test_find_references(literature_records): ] expected_references_bibtex = [ - '@article{1979PhLB...80..360E,\n author = "Ellis, John R.",\n title = "{Baryon Number Generation in Grand Unified Theories}"\n}\n', - '@article{Beacom:2004yd,\n author = "Beacom, John F.",\n title = "{Neutrinoless universe}"\n}\n', - '@article{hep-th/0501240,\n author = "Bern, Zvi",\n title = "{On-shell recurrence relations for one-loop QCD amplitudes}",\n eprint = "hep-th/0501240",\n archivePrefix = "arXiv"\n}\n', - '@article{JHEP.0412.015,\n author = "Dixon, Lance J.",\n title = "{MHV rules for Higgs plus multi-gluon amplitudes}",\n journal = "JHEP",\n volume = "12",\n pages = "015",\n year = "2004"\n}\n', + ( + '@article{1979PhLB...80..360E,\n author = "Ellis, John R.",\n title =' + ' "{Baryon Number Generation in Grand Unified Theories}"\n}\n' + ), + ( + '@article{Beacom:2004yd,\n author = "Beacom, John F.",\n title =' + ' "{Neutrinoless universe}"\n}\n' + ), + ( + '@article{hep-th/0501240,\n author = "Bern, Zvi",\n title =' + ' "{On-shell recurrence relations for one-loop QCD amplitudes}",\n ' + ' eprint = "hep-th/0501240",\n archivePrefix = "arXiv"\n}\n' + ), + ( + '@article{JHEP.0412.015,\n author = "Dixon, Lance J.",\n title =' + ' "{MHV rules for Higgs plus multi-gluon amplitudes}",\n journal =' + ' "JHEP",\n volume = "12",\n pages = "015",\n year = "2004"\n}\n' + ), ] expected_references_latex_us = [ - "%\\cite{1979PhLB...80..360E}\n\\bibitem{1979PhLB...80..360E}\nJ.~R.~Ellis,\n%``Baryon Number Generation in Grand Unified Theories,''\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{Beacom:2004yd}\n\\bibitem{Beacom:2004yd}\nJ.~F.~Beacom,\n%``Neutrinoless universe,''\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{hep-th/0501240}\n\\bibitem{hep-th/0501240}\nZ.~Bern,\n%``On-shell recurrence relations for one-loop QCD amplitudes,''\n[arXiv:hep-th/0501240 [hep-th]].\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{JHEP.0412.015}\n\\bibitem{JHEP.0412.015}\nL.~J.~Dixon,\n%``MHV rules for Higgs plus multi-gluon amplitudes,''\nJHEP \\textbf{12}, 015 (2004)\n%0 citations counted in INSPIRE as of 12 Jun 2020", + ( + "%\\cite{1979PhLB...80..360E}\n\\bibitem{1979PhLB...80..360E}\nJ.~R.~Ellis,\n%``Baryon" + " Number Generation in Grand Unified Theories,''\n%0 citations counted in" + " INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{Beacom:2004yd}\n\\bibitem{Beacom:2004yd}\nJ.~F.~Beacom,\n%``Neutrinoless" + " universe,''\n%0 citations counted in INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{hep-th/0501240}\n\\bibitem{hep-th/0501240}\nZ.~Bern,\n%``On-shell" + " recurrence relations for one-loop QCD" + " amplitudes,''\n[arXiv:hep-th/0501240 [hep-th]].\n%0 citations counted in" + " INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{JHEP.0412.015}\n\\bibitem{JHEP.0412.015}\nL.~J.~Dixon,\n%``MHV" + " rules for Higgs plus multi-gluon amplitudes,''\nJHEP \\textbf{12}, 015" + " (2004)\n%0 citations counted in INSPIRE as of 12 Jun 2020" + ), ] expected_references_latex_eu = [ - "%\\cite{1979PhLB...80..360E}\n\\bibitem{1979PhLB...80..360E}\nJ.~R.~Ellis,\n%``Baryon Number Generation in Grand Unified Theories,''\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{Beacom:2004yd}\n\\bibitem{Beacom:2004yd}\nJ.~F.~Beacom,\n%``Neutrinoless universe,''\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{hep-th/0501240}\n\\bibitem{hep-th/0501240}\nZ.~Bern,\n%``On-shell recurrence relations for one-loop QCD amplitudes,''\n[arXiv:hep-th/0501240 [hep-th]].\n%0 citations counted in INSPIRE as of 12 Jun 2020", - "%\\cite{JHEP.0412.015}\n\\bibitem{JHEP.0412.015}\nL.~J.~Dixon,\n%``MHV rules for Higgs plus multi-gluon amplitudes,''\nJHEP \\textbf{12} (2004), 015\n%0 citations counted in INSPIRE as of 12 Jun 2020", + ( + "%\\cite{1979PhLB...80..360E}\n\\bibitem{1979PhLB...80..360E}\nJ.~R.~Ellis,\n%``Baryon" + " Number Generation in Grand Unified Theories,''\n%0 citations counted in" + " INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{Beacom:2004yd}\n\\bibitem{Beacom:2004yd}\nJ.~F.~Beacom,\n%``Neutrinoless" + " universe,''\n%0 citations counted in INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{hep-th/0501240}\n\\bibitem{hep-th/0501240}\nZ.~Bern,\n%``On-shell" + " recurrence relations for one-loop QCD" + " amplitudes,''\n[arXiv:hep-th/0501240 [hep-th]].\n%0 citations counted in" + " INSPIRE as of 12 Jun 2020" + ), + ( + "%\\cite{JHEP.0412.015}\n\\bibitem{JHEP.0412.015}\nL.~J.~Dixon,\n%``MHV" + " rules for Higgs plus multi-gluon amplitudes,''\nJHEP \\textbf{12} (2004)," + " 015\n%0 citations counted in INSPIRE as of 12 Jun 2020" + ), ] expected_references_cv = [ - f'

\n \n Baryon Number Generation in Grand Unified Theories\n \n

\n \n

John R. Ellis

\n \n \n \n \n
', - f'

\n \n Neutrinoless universe\n \n

\n \n

John F. Beacom

\n \n \n \n \n
', - f'

\n \n On-shell recurrence relations for one-loop QCD amplitudes\n \n

\n \n

Zvi Bern

\n \n

\n e-Print:\n \n hep-th/0501240\n [hep-th]

\n \n \n
', - f'

\n \n MHV rules for Higgs plus multi-gluon amplitudes\n \n

\n \n

Lance J. Dixon

\n \n \n \n

\n Published in:\n JHEP 12 (2004),\n 015

\n
', + ( + "

\n \n ' + " Baryon Number Generation in Grand Unified Theories\n \n " + "

\n \n

John R.' + " Ellis

\n \n \n \n \n
" + ), + ( + "

\n \n ' + " Neutrinoless universe\n \n

\n \n

John F.' + " Beacom

\n \n \n \n \n
" + ), + ( + "

\n \n ' + " On-shell recurrence relations for one-loop QCD amplitudes\n \n " + "

\n \n

Zvi' + " Bern

\n \n

\n e-Print:\n \n hep-th/0501240\n ' + " [hep-th]

\n \n \n
" + ), + ( + "

\n \n ' + " MHV rules for Higgs plus multi-gluon amplitudes\n \n

\n " + " \n

Lance J.' + " Dixon

\n \n \n \n

\n Published in:\n JHEP 12" + " (2004),\n 015

\n
" + ), ] expected_errors = [ diff --git a/backend/tests/unit/assign/test_assign_views.py b/backend/tests/unit/assign/test_assign_views.py index 03784bc3d5..bcd4191b55 100644 --- a/backend/tests/unit/assign/test_assign_views.py +++ b/backend/tests/unit/assign/test_assign_views.py @@ -21,7 +21,10 @@ def test_author_bai_is_updated_correctly_in_ids_list(): "ids": [{"schema": "INSPIRE BAI", "value": "G.tHooft.1"}], "raw_affiliations": [ { - "value": "Institute for Theoretical Physics, Utrecht University Postbox, 80.089, 3508 TB Utrecht, Salerno, the Netherlands, Italy" + "value": ( + "Institute for Theoretical Physics, Utrecht University Postbox," + " 80.089, 3508 TB Utrecht, Salerno, the Netherlands, Italy" + ) } ], "record": {"$ref": ["Filtered"]}, diff --git a/backend/tests/unit/editor/test_authorlist_utils.py b/backend/tests/unit/editor/test_authorlist_utils.py index 6ca6ca15da..9ef65da7cf 100644 --- a/backend/tests/unit/editor/test_authorlist_utils.py +++ b/backend/tests/unit/editor/test_authorlist_utils.py @@ -138,7 +138,10 @@ def test_create_authors_with_missing_affid(): {"fullname": "A. Einstein", "affiliations": [], "ids": [], "emails": []}, {"fullname": "N. Bohr", "affiliations": [], "ids": [], "emails": []}, ] - warning = "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: N. Bohr 2" + warning = ( + "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: N." + " Bohr 2" + ) assert expected == result["authors"] assert warning in result["warnings"] @@ -146,7 +149,7 @@ def test_create_authors_with_missing_affid(): def test_create_authors_with_affid_but_missing_affiliation(): """Test case when some author has an affiliation id but no affiliation.""" - text = "A. Einstein1, N. Bohr2\n" "\n" "2 Københavns Universitet" + text = "A. Einstein1, N. Bohr2\n\n2 Københavns Universitet" result = create_authors(text) @@ -159,7 +162,10 @@ def test_create_authors_with_affid_but_missing_affiliation(): "emails": [], }, ] - warning = "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: A. Einstein 1" + warning = ( + "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: A." + " Einstein 1" + ) assert expected == result["authors"] assert warning in result["warnings"] @@ -167,7 +173,7 @@ def test_create_authors_with_affid_but_missing_affiliation(): def test_create_authors_with_invalid_affiliation(): """Test case when an affiliation has no valid id.""" - text = "A. Einstein1, N. Bohr2\n" "\n" "ETH\n" "2 Københavns Universitet" + text = "A. Einstein1, N. Bohr2\n\nETH\n2 Københavns Universitet" with pytest.raises(ValueError, match="Cannot identify type of affiliations"): create_authors(text) @@ -175,7 +181,7 @@ def test_create_authors_with_invalid_affiliation(): def test_create_authors_with_one_author_missing_affiliation(): """Test case when some author doesn't have an affiliation.""" - text = "A. Einstein, N. Bohr1,2\n" "\n" "1 ETH\n" "2 Københavns Universitet" + text = "A. Einstein, N. Bohr1,2\n\n1 ETH\n2 Københavns Universitet" result = create_authors(text) @@ -195,7 +201,7 @@ def test_create_authors_with_one_author_missing_affiliation(): def test_create_authors_ignores_space_between_authors_and_affiliations(): - text = "F. Lastname1, F.M. Otherlastname1,2\n" "\n" "1 CERN\n" "2 Otheraffiliation" + text = "F. Lastname1, F.M. Otherlastname1,2\n\n1 CERN\n2 Otheraffiliation" expected = [ {"fullname": "F. Lastname", "affiliations": ["CERN"], "ids": [], "emails": []}, @@ -257,17 +263,17 @@ def test_create_authors_bad_author_lines(): def test_create_authors_no_commas_between_authors(): text = ( - "C. Patrignani1 K. Agashe2 G. Aielli1,2\n" - "\n" - "1 Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy\n" - "2 University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "C. Patrignani1 K. Agashe2 G. Aielli1,2\n\n1 Universita di Bologna and INFN," + " Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy\n2 University" + " of Maryland, Department of Physics, College Park, MD 20742-4111, USA" ) expected = [ { "fullname": "C. Patrignani", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy" + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" ], "ids": [], "emails": [], @@ -275,7 +281,8 @@ def test_create_authors_no_commas_between_authors(): { "fullname": "K. Agashe", "affiliations": [ - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ], "ids": [], "emails": [], @@ -283,8 +290,14 @@ def test_create_authors_no_commas_between_authors(): { "fullname": "G. Aielli", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy", - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA", + ( + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" + ), + ( + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" + ), ], "ids": [], "emails": [], @@ -297,25 +310,18 @@ def test_create_authors_no_commas_between_authors(): def test_create_authors_newlines_and_no_commas_between_authors(): text = ( - "C. Patrignani\n" - "1\n" - "K. Agashe\n" - "2\n" - "G. Aielli\n" - "1,\n" - "2\n" - "\n" - "1\n" - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy\n" - "2\n" - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "C. Patrignani\n1\nK. Agashe\n2\nG. Aielli\n1,\n2\n\n1\nUniversita di Bologna" + " and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini," + " Italy\n2\nUniversity of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ) expected = [ { "fullname": "C. Patrignani", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy" + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" ], "ids": [], "emails": [], @@ -323,7 +329,8 @@ def test_create_authors_newlines_and_no_commas_between_authors(): { "fullname": "K. Agashe", "affiliations": [ - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ], "ids": [], "emails": [], @@ -331,8 +338,14 @@ def test_create_authors_newlines_and_no_commas_between_authors(): { "fullname": "G. Aielli", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy", - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA", + ( + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" + ), + ( + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" + ), ], "ids": [], "emails": [], @@ -345,25 +358,18 @@ def test_create_authors_newlines_and_no_commas_between_authors(): def test_create_authors_affids_with_dots(): text = ( - "C. Patrignani\n" - "1,\n" - "K. Agashe\n" - "2,\n" - "G. Aielli\n" - "1,\n" - "2\n" - "\n" - "1.\n" - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy\n" - "2.\n" - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "C. Patrignani\n1,\nK. Agashe\n2,\nG. Aielli\n1,\n2\n\n1.\nUniversita di" + " Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini," + " Italy\n2.\nUniversity of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ) expected = [ { "fullname": "C. Patrignani", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy" + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" ], "ids": [], "emails": [], @@ -371,7 +377,8 @@ def test_create_authors_affids_with_dots(): { "fullname": "K. Agashe", "affiliations": [ - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ], "ids": [], "emails": [], @@ -379,8 +386,14 @@ def test_create_authors_affids_with_dots(): { "fullname": "G. Aielli", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy", - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA", + ( + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" + ), + ( + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" + ), ], "ids": [], "emails": [], @@ -393,25 +406,18 @@ def test_create_authors_affids_with_dots(): def test_create_authors_no_commas_between_affids(): text = ( - "C. Patrignani\n" - "1,\n" - "K. Agashe\n" - "2,\n" - "G. Aielli\n" - "1\n" - "2\n" - "\n" - "1.\n" - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy\n" - "2.\n" - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "C. Patrignani\n1,\nK. Agashe\n2,\nG. Aielli\n1\n2\n\n1.\nUniversita di Bologna" + " and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini," + " Italy\n2.\nUniversity of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ) expected = [ { "fullname": "C. Patrignani", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy" + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" ], "ids": [], "emails": [], @@ -419,7 +425,8 @@ def test_create_authors_no_commas_between_affids(): { "fullname": "K. Agashe", "affiliations": [ - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ], "ids": [], "emails": [], @@ -427,8 +434,14 @@ def test_create_authors_no_commas_between_affids(): { "fullname": "G. Aielli", "affiliations": [ - "Universita di Bologna and INFN, Dip. Scienze per la Qualita della Vita, I-47921, Rimini, Italy", - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA", + ( + "Universita di Bologna and INFN, Dip. Scienze per la Qualita della" + " Vita, I-47921, Rimini, Italy" + ), + ( + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" + ), ], "ids": [], "emails": [], @@ -468,7 +481,10 @@ def test_create_authors_multiple_affiliations_on_single_line(): "emails": [], }, ] - warning = "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: Einstein 15" + warning = ( + "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id:" + " Einstein 15" + ) result = create_authors(text) @@ -477,7 +493,7 @@ def test_create_authors_multiple_affiliations_on_single_line(): def test_create_authors_space_between_affids(): - text = "Y.X. Ali1, 20, E I Andronov20\n" "\n" "1 CERN\n" "20 DESY" + text = "Y.X. Ali1, 20, E I Andronov20\n\n1 CERN\n20 DESY" expected = [("Y.X. Ali", ["CERN", "DESY"]), ("E I Andronov", ["DESY"])] expected = [ @@ -496,22 +512,18 @@ def test_create_authors_space_between_affids(): def test_create_authors_affiliation_with_numbers_and_letters(): text = ( - "O. Buchmueller\n" - "1\n" - "K. Agashe\n" - "2\n" - "\n" - "1.\n" - "High Energy Physics Group, Blackett Laboratory, Imperial College, Prince Consort Road, London SW7 2AZ, UK\n" - "2.\n" - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA\n" + "O. Buchmueller\n1\nK. Agashe\n2\n\n1.\nHigh Energy Physics Group, Blackett" + " Laboratory, Imperial College, Prince Consort Road, London SW7 2AZ," + " UK\n2.\nUniversity of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA\n" ) expected = [ { "fullname": "O. Buchmueller", "affiliations": [ - "High Energy Physics Group, Blackett Laboratory, Imperial College, Prince Consort Road, London SW7 2AZ, UK" + "High Energy Physics Group, Blackett Laboratory, Imperial College," + " Prince Consort Road, London SW7 2AZ, UK" ], "ids": [], "emails": [], @@ -519,7 +531,8 @@ def test_create_authors_affiliation_with_numbers_and_letters(): { "fullname": "K. Agashe", "affiliations": [ - "University of Maryland, Department of Physics, College Park, MD 20742-4111, USA" + "University of Maryland, Department of Physics, College Park, MD" + " 20742-4111, USA" ], "ids": [], "emails": [], @@ -532,7 +545,7 @@ def test_create_authors_affiliation_with_numbers_and_letters(): def test_create_authors_note_footnotes(): """Test authors which have some footnote symbols like † and ∗""" - text = "Y.X. Ali†1, 20, E I Andronov20∗\n" "\n" "1 CERN\n" "20 DESY" + text = "Y.X. Ali†1, 20, E I Andronov20∗\n\n1 CERN\n20 DESY" expected = expected = [ { @@ -543,7 +556,10 @@ def test_create_authors_note_footnotes(): }, {"fullname": "E I Andronov", "affiliations": ["DESY"], "ids": [], "emails": []}, ] - warning = "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id: Y.X. Ali †" + warning = ( + "Unresolved aff-ID or stray footnote symbol. Problematic author and aff-id:" + " Y.X. Ali †" + ) result = create_authors(text) assert expected == result["authors"] @@ -552,7 +568,7 @@ def test_create_authors_note_footnotes(): def test_create_authors_note_symbols(): """Test authors which have symbols like † and ∗""" - text = "Y.X. Aduszkiewicž†1, 20, E I Andronov20∗\n" "\n" "† CERN\n" "∗ DESY" + text = "Y.X. Aduszkiewicž†1, 20, E I Andronov20∗\n\n† CERN\n∗ DESY" expected = [ { @@ -573,30 +589,32 @@ def test_create_authors_note_symbols(): def test_create_authors_comma_wrong_position(): """Test case when there is comma before affiliation id.""" text = ( - "Y. Bao,\n" - "1\n" - "and A. Lambrecht,\n" - "1,\n" - "2\n" - "\n" - "1\n" - "Department of Physics, University of Florida, Gainesville, Florida 32611\n" - "2\n" - "Laboratoire Kastler-Brossel, CNRS, ENS, Universit ́e Pierre et Marie Curie case 74, Campus Jussieu, F-75252 Paris Cedex 05, France\n" + "Y. Bao,\n1\nand A. Lambrecht,\n1,\n2\n\n1\nDepartment of Physics, University" + " of Florida, Gainesville, Florida 32611\n2\nLaboratoire Kastler-Brossel, CNRS," + " ENS, Universit ́e Pierre et Marie Curie case 74, Campus Jussieu, F-75252 Paris" + " Cedex 05, France\n" ) expected = [ ( "Y. Bao", [ - "Department of Physics, University of Florida, Gainesville, Florida 32611" + "Department of Physics, University of Florida, Gainesville, Florida" + " 32611" ], ), ( "A. Lambrecht", [ - "Department of Physics, University of Florida, Gainesville, Florida 32611", - "Laboratoire Kastler-Brossel, CNRS, ENS, Universit \u0301e Pierre et Marie Curie case 74, Campus Jussieu, F-75252 Paris Cedex 05, France", + ( + "Department of Physics, University of Florida, Gainesville, Florida" + " 32611" + ), + ( + "Laboratoire Kastler-Brossel, CNRS, ENS, Universit \u0301e Pierre" + " et Marie Curie case 74, Campus Jussieu, F-75252 Paris Cedex 05," + " France" + ), ], ), ] @@ -604,7 +622,8 @@ def test_create_authors_comma_wrong_position(): { "fullname": "Y. Bao", "affiliations": [ - "Department of Physics, University of Florida, Gainesville, Florida 32611" + "Department of Physics, University of Florida, Gainesville, Florida" + " 32611" ], "ids": [], "emails": [], @@ -612,8 +631,15 @@ def test_create_authors_comma_wrong_position(): { "fullname": "A. Lambrecht", "affiliations": [ - "Department of Physics, University of Florida, Gainesville, Florida 32611", - "Laboratoire Kastler-Brossel, CNRS, ENS, Universit \u0301e Pierre et Marie Curie case 74, Campus Jussieu, F-75252 Paris Cedex 05, France", + ( + "Department of Physics, University of Florida, Gainesville, Florida" + " 32611" + ), + ( + "Laboratoire Kastler-Brossel, CNRS, ENS, Universit \u0301e Pierre" + " et Marie Curie case 74, Campus Jussieu, F-75252 Paris Cedex 05," + " France" + ), ], "ids": [], "emails": [], @@ -626,22 +652,17 @@ def test_create_authors_comma_wrong_position(): def test_create_authors_when_aff_line_ends_in_number(): text = ( - "T.M. Liss\n" - "1\n" - "L. Littenberg\n" - "2\n" - "\n" - "1.\n" - "Division of Science, City College of New York, 160 Convent Avenue, New York, NY 10031\n" - "2.\n" - "Physics Department, Brookhaven National Laboratory, Upton, NY 11973, USA" + "T.M. Liss\n1\nL. Littenberg\n2\n\n1.\nDivision of Science, City College of New" + " York, 160 Convent Avenue, New York, NY 10031\n2.\nPhysics Department," + " Brookhaven National Laboratory, Upton, NY 11973, USA" ) expected = [ { "fullname": "T.M. Liss", "affiliations": [ - "Division of Science, City College of New York, 160 Convent Avenue, New York, NY 10031" + "Division of Science, City College of New York, 160 Convent Avenue, New" + " York, NY 10031" ], "ids": [], "emails": [], @@ -649,7 +670,8 @@ def test_create_authors_when_aff_line_ends_in_number(): { "fullname": "L. Littenberg", "affiliations": [ - "Physics Department, Brookhaven National Laboratory, Upton, NY 11973, USA" + "Physics Department, Brookhaven National Laboratory, Upton, NY" + " 11973, USA" ], "ids": [], "emails": [], @@ -689,7 +711,7 @@ def test_create_authors_with_many_affiliations(): def test_create_authors_handles_spaces_at_the_end_of_an_author_or_affiliation(): - text = "J. Smith1 \n" "\n" "1 University of somewhere " + text = "J. Smith1 \n\n1 University of somewhere " expected = [("J. Smith", ["University of somewhere"])] expected = [ @@ -706,7 +728,7 @@ def test_create_authors_handles_spaces_at_the_end_of_an_author_or_affiliation(): def test_create_authors_with_letters(): - text = "J. Mills a L. di Caprio\n" "B. Smith bb\n" "\n" "a CERN\n" "bb Fermilab\n" + text = "J. Mills a L. di Caprio\nB. Smith bb\n\na CERN\nbb Fermilab\n" expected = [ { @@ -739,7 +761,7 @@ def test_create_authors_with_letters(): def test_create_authors_unused_affiliation(): - text = "K. Sachs 1, F. Schwennsen 1\n" "\n" "1 DESY\n" "2 CERN\n" + text = "K. Sachs 1, F. Schwennsen 1\n\n1 DESY\n2 CERN\n" expected = [ { @@ -806,20 +828,11 @@ def test_create_authors_author_blocks_by_affiliation(): def test_create_authors_with_affiliation_get_emails_and_orcid(): text = ( - "Dan Hooper\n" - "1,2,3,4\n" - "Aurora Ireland\n" - "3,5,6\n" - "Gordan Krnjaic\n" - "1,2,3,7\n" - "\n" - "1 john.smith@example.org\n" - "2 jane.smith@example.org\n" - "3 Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US\n" - "4 0000-0001-8837-4127\n" - "5 University of Chicago,Department of Physics,Chicago IL,USA\n" - "6 0000-0002-3004-0930\n" - "7 0000-0001-7420-9577\n" + "Dan Hooper\n1,2,3,4\nAurora Ireland\n3,5,6\nGordan Krnjaic\n1,2,3,7\n\n1" + " john.smith@example.org\n2 jane.smith@example.org\n3 Fermi National" + " Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US\n4" + " 0000-0001-8837-4127\n5 University of Chicago,Department of Physics,Chicago" + " IL,USA\n6 0000-0002-3004-0930\n7 0000-0001-7420-9577\n" ) expected = [ @@ -827,7 +840,10 @@ def test_create_authors_with_affiliation_get_emails_and_orcid(): "full_name": "Hooper, Dan", "raw_affiliations": [ { - "value": "Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US", + "value": ( + "Fermi National Accelerator Laboratory,Theoretical Astrophysics" + " Group,Batavia,IL,US" + ), } ], "emails": ["john.smith@example.org", "jane.smith@example.org"], @@ -842,7 +858,10 @@ def test_create_authors_with_affiliation_get_emails_and_orcid(): "full_name": "Ireland, Aurora", "raw_affiliations": [ { - "value": "Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US", + "value": ( + "Fermi National Accelerator Laboratory,Theoretical Astrophysics" + " Group,Batavia,IL,US" + ), }, {"value": "University of Chicago,Department of Physics,Chicago IL,USA"}, ], @@ -857,7 +876,10 @@ def test_create_authors_with_affiliation_get_emails_and_orcid(): "full_name": "Krnjaic, Gordan", "raw_affiliations": [ { - "value": "Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US", + "value": ( + "Fermi National Accelerator Laboratory,Theoretical Astrophysics" + " Group,Batavia,IL,US" + ), } ], "emails": ["john.smith@example.org", "jane.smith@example.org"], @@ -877,13 +899,9 @@ def test_create_authors_with_affiliation_get_emails_and_orcid(): def test_create_authors_with_affiliation_authorlist(): text = ( - "Dan Hooper\n" - "1\n" - "Aurora Ireland\n" - "1,2\n" - "\n" - "1 Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US\n" - "2 University of Chicago,Department of Physics,Chicago IL,USA\n" + "Dan Hooper\n1\nAurora Ireland\n1,2\n\n1 Fermi National Accelerator" + " Laboratory,Theoretical Astrophysics Group,Batavia,IL,US\n2 University of" + " Chicago,Department of Physics,Chicago IL,USA\n" ) expected = [ @@ -891,7 +909,10 @@ def test_create_authors_with_affiliation_authorlist(): "full_name": "Hooper, Dan", "raw_affiliations": [ { - "value": "Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US", + "value": ( + "Fermi National Accelerator Laboratory,Theoretical Astrophysics" + " Group,Batavia,IL,US" + ), } ], }, @@ -899,7 +920,10 @@ def test_create_authors_with_affiliation_authorlist(): "full_name": "Ireland, Aurora", "raw_affiliations": [ { - "value": "Fermi National Accelerator Laboratory,Theoretical Astrophysics Group,Batavia,IL,US", + "value": ( + "Fermi National Accelerator Laboratory,Theoretical Astrophysics" + " Group,Batavia,IL,US" + ), }, {"value": "University of Chicago,Department of Physics,Chicago IL,USA"}, ], diff --git a/backend/tests/unit/mailing/test_utils.py b/backend/tests/unit/mailing/test_utils.py index ca5c73665b..5280e4087e 100644 --- a/backend/tests/unit/mailing/test_utils.py +++ b/backend/tests/unit/mailing/test_utils.py @@ -36,8 +36,19 @@ def test_strip_html_tags_empty_string(): def test_strip_html_tags(): - html = "

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.

" - expected = "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo." + html = ( + "

Pellentesque habitant morbi tristique senectus et netus et malesuada" + " fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae," + " ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas" + " semper. Aenean ultricies mi vitae est. Mauris placerat eleifend" + " leo.

" + ) + expected = ( + "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac" + " turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor" + " sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean" + " ultricies mi vitae est. Mauris placerat eleifend leo." + ) result = strip_html_tags(html) assert result == expected diff --git a/backend/tests/unit/matcher/test_parsers.py b/backend/tests/unit/matcher/test_parsers.py index 6bba01b6fd..c9e035d2bc 100644 --- a/backend/tests/unit/matcher/test_parsers.py +++ b/backend/tests/unit/matcher/test_parsers.py @@ -40,7 +40,7 @@ def test_grobid_to_reference(): "isbn": "9783642239083", "publication_info": { "journal_issue": "1", - "journal_title": "Expert. Opin. Ther. " "Targets", + "journal_title": "Expert. Opin. Ther. Targets", "journal_volume": "6", "page_end": "113", "page_start": "103", @@ -92,10 +92,12 @@ def test_grobid_to_reference_doesnt_return_empty_values(): "reference": { "arxiv_eprint": "1009.1212", "publication_info": { - "journal_title": "N=2 Instanton Effective " - "Action in Ω-background " - "and D3/D(-1)-brane " - "System in R-R Background", + "journal_title": ( + "N=2 Instanton Effective " + "Action in Ω-background " + "and D3/D(-1)-brane " + "System in R-R Background" + ), "year": 2010, "page_start": "93", }, @@ -125,11 +127,13 @@ def test_grobid_to_reference_with_report_number(): expected = { "reference": { "publication_info": { - "journal_title": "Selection of jets " - "produced " - "in13TeVproton-proton " - "collisions with the " - "ATLASdetector", + "journal_title": ( + "Selection of jets " + "produced " + "in13TeVproton-proton " + "collisions with the " + "ATLASdetector" + ), "year": 2015, }, "report_numbers": ["ATLAS-CONF-2015-029"], diff --git a/backend/tests/unit/matcher/test_utils.py b/backend/tests/unit/matcher/test_utils.py index 0d4d249eee..41b54a2bf4 100644 --- a/backend/tests/unit/matcher/test_utils.py +++ b/backend/tests/unit/matcher/test_utils.py @@ -13,7 +13,9 @@ def test_map_refextract_to_schema(): "journal_year": ["1964"], "linemarker": ["1"], "raw_ref": [ - "[1] F. Englert and R. Brout, \u201cBroken symmetry and the mass of gauge vector mesons\u201d, Phys. Rev. Lett. 13 (1964) 321, doi:10.1103/PhysRevLett.13.321." + "[1] F. Englert and R. Brout, \u201cBroken symmetry and the mass of" + " gauge vector mesons\u201d, Phys. Rev. Lett. 13 (1964) 321," + " doi:10.1103/PhysRevLett.13.321." ], "texkey": ["Englert:1964et"], "year": ["1964"], @@ -33,7 +35,11 @@ def test_map_refextract_to_schema(): "raw_refs": [ { "schema": "text", - "value": "[1] F. Englert and R. Brout, “Broken symmetry and the mass of gauge vector mesons”, Phys. Rev. Lett. 13 (1964) 321, doi:10.1103/PhysRevLett.13.321.", + "value": ( + "[1] F. Englert and R. Brout, “Broken symmetry and the mass of" + " gauge vector mesons”, Phys. Rev. Lett. 13 (1964) 321," + " doi:10.1103/PhysRevLett.13.321." + ), } ], } diff --git a/backend/tests/unit/records/marshmallow/literature/common/test_abstract_source.py b/backend/tests/unit/records/marshmallow/literature/common/test_abstract_source.py index 48683b3d01..e936f05dfd 100644 --- a/backend/tests/unit/records/marshmallow/literature/common/test_abstract_source.py +++ b/backend/tests/unit/records/marshmallow/literature/common/test_abstract_source.py @@ -31,13 +31,17 @@ def test_abstract_source_full( "abstracts": [ { "source": "submitter", - "value": "Imaginem gi converto defectus interdum ad si alterius to." - "Qua ego lus cogitare referrem mansurum importat.", + "value": ( + "Imaginem gi converto defectus interdum ad si alterius to." + "Qua ego lus cogitare referrem mansurum importat." + ), }, { "source": "arXiv", - "value": "Imaginem gi converto defectus interdum ad si alterius to." - "Qua ego lus cogitare referrem mansurum importat.", + "value": ( + "Imaginem gi converto defectus interdum ad si alterius to." + "Qua ego lus cogitare referrem mansurum importat." + ), }, ] } @@ -67,13 +71,17 @@ def test_abstract_source_one_missing_source( data = { "abstracts": [ { - "value": "Imaginem gi converto defectus interdum ad si alterius to." - "Qua ego lus cogitare referrem mansurum importat." + "value": ( + "Imaginem gi converto defectus interdum ad si alterius to." + "Qua ego lus cogitare referrem mansurum importat." + ) }, { "source": "arXiv", - "value": "Imaginem gi converto defectus interdum ad si alterius to." - "Qua ego lus cogitare referrem mansurum importat.", + "value": ( + "Imaginem gi converto defectus interdum ad si alterius to." + "Qua ego lus cogitare referrem mansurum importat." + ), }, ] } @@ -124,8 +132,10 @@ def test_abstract_source_one_only( "abstracts": [ { "source": "arXiv", - "value": "Imaginem gi converto defectus interdum ad si alterius to." - "Qua ego lus cogitare referrem mansurum importat.", + "value": ( + "Imaginem gi converto defectus interdum ad si alterius to." + "Qua ego lus cogitare referrem mansurum importat." + ), } ] } diff --git a/backend/tests/unit/records/marshmallow/literature/common/test_author.py b/backend/tests/unit/records/marshmallow/literature/common/test_author.py index 9a54bd3731..0ddb52dce6 100644 --- a/backend/tests/unit/records/marshmallow/literature/common/test_author.py +++ b/backend/tests/unit/records/marshmallow/literature/common/test_author.py @@ -113,7 +113,10 @@ def test_first_author(): "recid": 1032336, "raw_affiliations": [ { - "value": "LIGO - California Institute of Technology - Pasadena - CA 91125 - USA" + "value": ( + "LIGO - California Institute of Technology - Pasadena - CA 91125" + " - USA" + ) } ], "affiliations": [ diff --git a/backend/tests/unit/records/marshmallow/literature/common/test_external_system_identifier.py b/backend/tests/unit/records/marshmallow/literature/common/test_external_system_identifier.py index 68f4ef96ed..84aeaf103b 100644 --- a/backend/tests/unit/records/marshmallow/literature/common/test_external_system_identifier.py +++ b/backend/tests/unit/records/marshmallow/literature/common/test_external_system_identifier.py @@ -139,7 +139,9 @@ class TestSchema(Schema): expected = { "external_system_identifiers": [ { - "url_link": "https://lib-extopc.kek.jp/preprints/PDF/2007/0727/0727065.pdf", # noqa + "url_link": ( # noqa + "https://lib-extopc.kek.jp/preprints/PDF/2007/0727/0727065.pdf" + ), "url_name": "KEK scanned document", } ] @@ -163,7 +165,9 @@ class TestSchema(Schema): expected = { "external_system_identifiers": [ { - "url_link": "https://lib-extopc.kek.jp/preprints/PDF/2007/0727/0727065.pdf", # noqa + "url_link": ( # noqa + "https://lib-extopc.kek.jp/preprints/PDF/2007/0727/0727065.pdf" + ), "url_name": "KEK scanned document", } ] @@ -185,7 +189,9 @@ class TestSchema(Schema): expected = { "external_system_identifiers": [ { - "url_link": "https://lib-extopc.kek.jp/preprints/PDF/1993/9327/9327065.pdf", # noqa + "url_link": ( # noqa + "https://lib-extopc.kek.jp/preprints/PDF/1993/9327/9327065.pdf" + ), "url_name": "KEK scanned document", } ] diff --git a/backend/tests/unit/records/marshmallow/literature/common/test_reference_item.py b/backend/tests/unit/records/marshmallow/literature/common/test_reference_item.py index ca0e2415db..f8d23d8b3e 100644 --- a/backend/tests/unit/records/marshmallow/literature/common/test_reference_item.py +++ b/backend/tests/unit/records/marshmallow/literature/common/test_reference_item.py @@ -155,11 +155,17 @@ def test_returns_no_misc_if_titles_persent_in_the_resolved_record( "titles": [ { "source": "arXiv", - "title": "Theoretical limit of residual amplitude modulation in electro-optic modulators", # noqa + "title": ( # noqa + "Theoretical limit of residual amplitude modulation in" + " electro-optic modulators" + ), }, { "source": "arXiv", - "title": "Fundamental level of residual amplitude modulation in phase modulation processes", # noqa + "title": ( # noqa + "Fundamental level of residual amplitude modulation in" + " phase modulation processes" + ), }, ], } @@ -267,7 +273,13 @@ def test_schema_v2_returns_raw_ref( dump = { "raw_refs": [ { - "value": "[1] M. Freer, H. Horiuchi, Y. Kanada-En’yo, D. Lee, and Ulf-G Meißner. Microscopic clustering in light nuclei. Reviews of Modern Physics, 90(3):035004, 2018. doi: https://doi.org/10.1103/RevModPhys.90.035004. URL https://link.aps.org/ doi/10.1103/RevModPhys.90.035004.", + "value": ( + "[1] M. Freer, H. Horiuchi, Y. Kanada-En’yo, D. Lee, and Ulf-G" + " Meißner. Microscopic clustering in light nuclei. Reviews of" + " Modern Physics, 90(3):035004, 2018. doi:" + " https://doi.org/10.1103/RevModPhys.90.035004. URL" + " https://link.aps.org/ doi/10.1103/RevModPhys.90.035004." + ), "schema": "text", "source": "desy", } @@ -279,7 +291,12 @@ def test_schema_v2_returns_raw_ref( expected = { "control_number": 123, "arxiv_eprint": [{"value": "1606.09129"}], - "raw_ref": "[1] M. Freer, H. Horiuchi, Y. Kanada-En’yo, D. Lee, and Ulf-G Meißner. Microscopic clustering in light nuclei. Reviews of Modern Physics, 90(3):035004, 2018. doi: https://doi.org/10.1103/RevModPhys.90.035004. URL https://link.aps.org/ doi/10.1103/RevModPhys.90.035004.", + "raw_ref": ( + "[1] M. Freer, H. Horiuchi, Y. Kanada-En’yo, D. Lee, and Ulf-G Meißner." + " Microscopic clustering in light nuclei. Reviews of Modern Physics," + " 90(3):035004, 2018. doi: https://doi.org/10.1103/RevModPhys.90.035004." + " URL https://link.aps.org/ doi/10.1103/RevModPhys.90.035004." + ), } result = schema.dumps(dump).data assert expected == orjson.loads(result) diff --git a/backend/tests/unit/records/marshmallow/literature/test_base_schema.py b/backend/tests/unit/records/marshmallow/literature/test_base_schema.py index 124e73f161..753a8c22aa 100644 --- a/backend/tests/unit/records/marshmallow/literature/test_base_schema.py +++ b/backend/tests/unit/records/marshmallow/literature/test_base_schema.py @@ -139,7 +139,10 @@ def test_fulltext_indexing_error_is_excluded_from_documents(): "text": "asdfsdfbajabjbasdasdasd=", "attachment": {"content": "this is a text"}, "_error": { - "message": "Fulltext indexing failed with message expected='>' actual='À' at offset 102005" + "message": ( + "Fulltext indexing failed with message expected='>' actual='À'" + " at offset 102005" + ) }, } ] diff --git a/backend/tests/unit/records/marshmallow/literature/test_es_schema.py b/backend/tests/unit/records/marshmallow/literature/test_es_schema.py index b20c14056f..f03344cf04 100644 --- a/backend/tests/unit/records/marshmallow/literature/test_es_schema.py +++ b/backend/tests/unit/records/marshmallow/literature/test_es_schema.py @@ -117,7 +117,10 @@ def test_es_schema_removes_fulltext_indexing_errors( "text": "asdfsdfbajabjbasdasdasd=", "attachment": {"content": "this is a text"}, "error": { - "message": "Fulltext indexing failed with message expected='>' actual='À' at offset 102005" + "message": ( + "Fulltext indexing failed with message expected='>' actual='À'" + " at offset 102005" + ) }, } ] diff --git a/backend/tests/unit/records/marshmallow/literature/test_literature_marshmallow_utils.py b/backend/tests/unit/records/marshmallow/literature/test_literature_marshmallow_utils.py index 11a5a6d50e..96fd87a069 100644 --- a/backend/tests/unit/records/marshmallow/literature/test_literature_marshmallow_utils.py +++ b/backend/tests/unit/records/marshmallow/literature/test_literature_marshmallow_utils.py @@ -19,8 +19,14 @@ def test_latex_encode_escapes_special_chars(): def test_latex_encode_do_not_escape_curly_brakcets(): - text = r"Search for Axion Like Particle Production in 400-{GeV} Proton - Copper Interactions" - expected = r"Search for Axion Like Particle Production in 400-{GeV} Proton - Copper Interactions" + text = ( + r"Search for Axion Like Particle Production in 400-{GeV} Proton - Copper" + r" Interactions" + ) + expected = ( + r"Search for Axion Like Particle Production in 400-{GeV} Proton - Copper" + r" Interactions" + ) assert expected == latex_encode(text) @@ -33,7 +39,11 @@ def test_latex_encode_escapes_non_ascii(): def test_latex_encode_escapes_math_by_default(): text = r"Paper on $\gamma$-ray bursts and \(\mu\)-neutrinos \o/" - expected = r"Paper on \$\textbackslash{}gamma\$-ray bursts and \textbackslash{}(\textbackslash{}mu\textbackslash{})-neutrinos \textbackslash{}o/" + expected = ( + r"Paper on \$\textbackslash{}gamma\$-ray bursts and" + r" \textbackslash{}(\textbackslash{}mu\textbackslash{})-neutrinos" + r" \textbackslash{}o/" + ) assert expected == latex_encode(text) @@ -54,7 +64,10 @@ def test_latex_encode_encodes_the_right_parts_when_contains_math_is_true_and_sta def test_latex_encode_is_correct_when_contains_math_is_true_and_no_math(): text = r"Paper on γ-ray bursts and μ-neutrinos \o/" - expected = r"Paper on \ensuremath{\gamma}-ray bursts and \ensuremath{\mu}-neutrinos \textbackslash{}o/" + expected = ( + r"Paper on \ensuremath{\gamma}-ray bursts and \ensuremath{\mu}-neutrinos" + r" \textbackslash{}o/" + ) assert expected == latex_encode(text, contains_math=True) diff --git a/backend/tests/unit/records/marshmallow/literature/test_ui.py b/backend/tests/unit/records/marshmallow/literature/test_ui.py index b975a1f931..5129f9a4ec 100644 --- a/backend/tests/unit/records/marshmallow/literature/test_ui.py +++ b/backend/tests/unit/records/marshmallow/literature/test_ui.py @@ -268,7 +268,10 @@ def test_documents_doesnt_contain_error_from_fulltext( "fulltext": False, "url": "http://localhost:8080/api/files/url_to_file", "error": { - "message": "Fulltext indexing failed with message expected='>' actual='À' at offset 102005" + "message": ( + "Fulltext indexing failed with message expected='>' actual='À'" + " at offset 102005" + ) }, } ], diff --git a/backend/tests/unit/records/test_bibtex.py b/backend/tests/unit/records/test_bibtex.py index 7c28e57181..188ebc353d 100644 --- a/backend/tests/unit/records/test_bibtex.py +++ b/backend/tests/unit/records/test_bibtex.py @@ -6,12 +6,18 @@ def test_bibtext_not_break_on_wrong_data(): data = { "titles": [ { - "title": "Results of the analysis of test Beam data collected at Fermilab with incident muons for the Hadronic Section of the ZEUS Barrel Calorimeter" + "title": ( + "Results of the analysis of test Beam data collected at Fermilab" + " with incident muons for the Hadronic Section of the ZEUS Barrel" + " Calorimeter" + ) } ], "authors": [ { - "full_name": "L. Chen, R. Imlay, S. Kartik, H.J.Kim, R. McNeil, W. Metcalf" + "full_name": ( + "L. Chen, R. Imlay, S. Kartik, H.J.Kim, R. McNeil, W. Metcalf" + ) } ], "document_type": ["article"], diff --git a/ruff.toml b/ruff.toml index 0b6abdf12e..c6c8029a34 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,4 @@ target-version = "py311" - [lint.flake8-tidy-imports] ban-relative-imports = "all"