def test_is_arxiv_set_with_affiliations_field_without_arxiv_eprint(): data = { "authors": [{ "full_name": "cern", "affiliations": [{ "value": "CERN" }] }] } record = faker.record("lit", data) assert False is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_report_numbers(): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "report_numbers": [{ "value": "CERN-TH-2020-136" }], } record = faker.record("lit", data) assert True is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_doi(): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "dois": [{ "value": "10.23730/CYRSP-2019-006.261" }], } record = faker.record("lit", data) assert True is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_collaborations(collaboration, expected): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "collaborations": [{ "value": collaboration }], } record = faker.record("lit", data) assert expected is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_wrong_collection(): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "_collections": ["SLAC"], "report_numbers": [{ "value": "CERN-TH-2020-136" }], } record = faker.record("lit", data) assert False is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_accelerators_experiments_field( experiment_name, expected): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "accelerator_experiments": [{ "legacy_name": experiment_name }], } record = faker.record("lit", data) assert expected is is_cern_arxiv_set(record)
def get_oai(self, record): sets = [] if is_cds_set(record): sets.append(current_app.config["OAI_SET_CDS"]) if is_cern_arxiv_set(record): sets.append(current_app.config["OAI_SET_CERN_ARXIV"]) if sets: return { "id": f"oai:inspirehep.net:{record['control_number']}", "sets": sets, "updated": record.updated, } return missing
def test_is_arxiv_set_with_affiliations_field_with_wrong_collection(): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "_collections": ["SLAC"], "authors": [{ "full_name": "cern", "affiliations": [{ "value": "CERN" }] }], } record = faker.record("lit", data) assert False is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_affiliations_field(): data = { "arxiv_eprints": [{ "value": "2009.01484" }], "curated": True, "authors": [{ "full_name": "cern", "affiliations": [{ "value": "CERN" }], }], } record = faker.record("lit", data) assert True is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_collection_and_without_arxiv_eprints(): data = {"report_numbers": [{"value": "CERN-TH-2020-136"}]} record = faker.record("lit", data) assert False is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_collaborations_without_arxiv_eprints( collaboration, expected): data = {"collaborations": [{"value": collaboration}]} record = faker.record("lit", data) assert expected is is_cern_arxiv_set(record)
def test_is_arxiv_set_with_accelerators_experiments_field_without_arxiv_eprint( experiment_name, expected): data = {"accelerator_experiments": [{"legacy_name": experiment_name}]} record = faker.record("lit", data) assert expected is is_cern_arxiv_set(record)