def test_issnl_mapping_lookup(api): with open('tests/files/ISSN-to-ISSN-L.snip.txt', 'r') as issn_file: fi = CrossrefImporter(api, issn_map_file=issn_file) assert fi.issn2issnl('0000-0027') == '0002-0027' assert fi.issn2issnl('0002-0027') == '0002-0027' assert fi.issn2issnl('9999-0027') == None assert fi.lookup_issnl('9999-9999') == None
def crossref_importer(api): with open('tests/files/ISSN-to-ISSN-L.snip.txt', 'r') as issn_file: yield CrossrefImporter( api, issn_file, extid_map_file='tests/files/example_map.sqlite3', bezerk_mode=True)
def run_crossref(args: argparse.Namespace) -> None: fci = CrossrefImporter( args.api, args.issn_map_file, edit_batch_size=args.batch_size, bezerk_mode=args.bezerk_mode, ) if args.kafka_mode: KafkaJsonPusher( fci, args.kafka_hosts, args.kafka_env, "api-crossref", "fatcat-{}-import-crossref".format(args.kafka_env), consume_batch_size=args.batch_size, ).run() else: JsonLinePusher(fci, args.json_file).run()
def test_identifiers(api): with open('tests/files/ISSN-to-ISSN-L.snip.txt', 'r') as issn_file: ci = CrossrefImporter(api, issn_map_file=issn_file) assert ci.is_issnl("1234-5678") == True assert ci.is_issnl("1234-5678.") == False assert ci.is_issnl("12345678") == False assert ci.is_issnl("1-2345678") == False oi = OrcidImporter(api) assert oi.is_orcid("0000-0003-3118-6591") == True assert oi.is_orcid("0000-0003-3953-765X") == True assert oi.is_orcid("0000-00x3-3118-659") == False assert oi.is_orcid("0000-00033118-659") == False assert oi.is_orcid("0000-0003-3118-659.") == False
def crossref_importer_existing(api): with open("tests/files/ISSN-to-ISSN-L.snip.txt", "r") as issn_file: yield CrossrefImporter(api, issn_file, bezerk_mode=False)