def test_check_issn(): assert check_issn("") == "" assert check_issn("1") == "" assert check_issn("12") == "" assert check_issn("123") == "" assert check_issn("1234") == "" assert check_issn("12345") == "" assert check_issn("123456") == "" assert check_issn("1234567") == "" assert check_issn("12345678") == "1234-5678" assert check_issn("1234-5678") == "1234-5678" assert check_issn("1234-5678X") == "1234-5678" assert check_issn("1234-5678X3344") == "1234-5678" assert check_issn("9780201038019 is an valid isbn") == "978020103"
newrecord.add("007", data=f007) # ISBN try: isbn = oldrecord["020"]["a"] except: isbn = "" f020a = check_isbn(isbn) newrecord.add("020", a=f020a) # ISSN try: issn = oldrecord["022"]["a"] except: issn = "" f022a = check_issn(issn) newrecord.add("022", a=f022a) # RDA-Inhaltstyp f336b = formats[format]["336b"] newrecord.add("336", b=f336b) # RDA-Datenträgertyp f338b = formats[format]["338b"] newrecord.add("338", b=f338b) # Originalfelder, die ohne Änderung übernommen werden for tag in copytags: for field in oldrecord.get_fields(tag): newrecord.add_field(field)
# Periodizität year = oldrecord.get("dc:date", "") periodicity = formats[format]["008"] language = oldrecord.get("dc:language", [""]) language = language[0] f008 = marc_build_field_008(year, periodicity, language) marcrecord.add("008", data=f008) # ISBN und ISSN numbers = oldrecord["dc:identifier"] for number in numbers: if "ISBN" in number: f020a = check_isbn(number) marcrecord.add("020", a=f020a) if "ISSN" in number: f022a = check_issn(number) marcrecord.add("022", a=f022a) # Sprache f041a = oldrecord.get("dc:language", [""]) f041a = f041a[0] if f041a and len(f041a) != 3: sys.exit("Die Sprache ist nicht MARC-konform: " + f041a) marcrecord.add("041", a=f041a) # DDC-Notation if setspec == "gallica:theme:0:00": marcrecord.add("082", a="000") elif setspec == "gallica:theme:0:02": marcrecord.add("082", a="020") elif setspec == "gallica:typedoc:partitions":