コード例 #1
0
def test_serialize(app):
    """Test JSON serialize."""
    data = MARCXMLSerializer(to_marc21, schema_class=MySchema).serialize(
        PersistentIdentifier(pid_type="recid", pid_value="2"),
        Record({"title": "test"}))
    expected = (u"<?xml version='1.0' encoding='UTF-8'?>\n"
                u'<record xmlns="http://www.loc.gov/MARC21/slim">\n'
                u'  <controlfield tag="001">2</controlfield>\n'
                u"</record>\n")
    assert data.decode("utf8") == expected
コード例 #2
0
def test_serialize(app):
    """Test JSON serialize."""
    data = MARCXMLSerializer(to_marc21, schema_class=MySchema).serialize(
        PersistentIdentifier(pid_type='recid', pid_value='2'),
        Record({'title': 'test'}))
    expected = u"<?xml version='1.0' encoding='UTF-8'?>\n" \
               u'<record xmlns="http://www.loc.gov/MARC21/slim">\n' \
               u'  <controlfield tag="001">2</controlfield>\n' \
               u'</record>\n'
    assert data.decode('utf8') == expected
コード例 #3
0
def test_serialize(app):
    """Test JSON serialize."""
    data = MARCXMLSerializer(to_marc21, schema_class=MySchema).serialize(
        PersistentIdentifier(pid_type='recid', pid_value='2'),
        Record({'title': 'test'}))
    expected = u"<?xml version='1.0' encoding='UTF-8'?>\n" \
               u'<record xmlns="http://www.loc.gov/MARC21/slim">\n' \
               u'  <controlfield tag="001">2</controlfield>\n' \
               u'</record>\n'
    assert data.decode('utf8') == expected