예제 #1
0
def test_marc21_to_languages_ebooks():
    """No languages in ebooks."""
    marc21xml = """
    <record>
        <datafield tag="024" ind1="8" ind2=" ">
            <subfield code="a">http://cantookstation.com/resources/1</subfield>
        </datafield>
    </record>
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert data.get('languages') == [{'language': 'und'}]
예제 #2
0
def test_marc21_to_type_ebooks():
    """Electronic Locations."""
    marc21xml = """
    <record>
      <datafield tag="024" ind1="8" ind2=" ">
        <subfield code="a">http://cantookstation.com/resources/1</subfield>
      </datafield>
    </record
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert data.get('type') == 'ebook'
예제 #3
0
def test_marc21_to_isbn_ebooks():
    """Test dojson publishers publicationDate."""

    marc21xml = """
    <record>
      <datafield tag="020" ind1=" " ind2=" ">
        <subfield code="a">9782812933868</subfield>
      </datafield>
    </record>
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert data.get('identifiers') == {'isbn': '9782812933868'}

    marc21xml = """
    <record>
      <datafield tag="020" ind1=" " ind2=" ">
        <subfield code="a">feedhttps-www-feedbooks-com-book-414-epub</subfield>
      </datafield>
    </record>
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert not data.get('identifiers')
예제 #4
0
def test_marc21_to_publishers_ebooks():
    """Test dojson publishers publicationDate."""

    marc21xml = """
    <record>
      <datafield tag="260" ind1=" " ind2=" ">
        <subfield code="a">Lausanne :</subfield>
        <subfield code="b"/>
        <subfield code="c">2015</subfield>
      </datafield>
    </record>
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert data.get('publishers') == [{'place': ['Lausanne']}]
예제 #5
0
def test_marc21_to_electronic_location_ebooks():
    """Electronic Locations."""
    marc21xml = """
    <record>
      <datafield tag="856" ind1="4" ind2="0">
        <subfield code="u">http://site1.org/resources/1</subfield>
      </datafield>
      <datafield tag="856" ind1="4" ind2="0">
        <subfield code="u">http://site2.org/resources/2</subfield>
      </datafield>
    </record>
    """
    marc21json = create_record(marc21xml)
    data = marc21.do(marc21json)
    assert data.get('electronic_location') == [{
        'uri':
        'http://site1.org/resources/1'
    }, {
        'uri':
        'http://site2.org/resources/2'
    }]