CERNDocumentServer / harvesting-kit

A kit containing various utilities and scripts related to content harvesting used in Invenio Software (http://invenio-software.org) instances such as INSPIRE (http://inspirehep.net) and SCOAP3 (http://scoap3.org)
GNU General Public License v2.0
7 stars 18 forks source link

Utils: changes to record_add_field, better XML handling. #70

Closed Dziolas closed 10 years ago

Dziolas commented 10 years ago

Co-authored-by: Georgios Papoutsakis georgios.papoutsakis@cern.ch

jalavik commented 10 years ago

Two tests fail actually:

$ nosetests harvestingkit/tests
======================================================================
ERROR: test_record_add_field (harvestingkit.tests.utils_tests.UtilsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jlavik/src/harvesting-kit/harvestingkit/tests/utils_tests.py", line 41, in test_record_add_field
    record_add_field(rec, '520', subfields=[('a', data)])
  File "/home/jlavik/src/harvesting-kit/harvestingkit/utils.py", line 39, in record_add_field
    data = parseString(data).firstChild
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
ExpatError: syntax error: line 1, column 0

======================================================================
FAIL: test_get_inner_xml (harvestingkit.tests.minidom_utils_tests.MinidomUtilsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jlavik/src/harvesting-kit/harvestingkit/tests/minidom_utils_tests.py", line 43, in test_get_inner_xml
    self.assertEqual(get_inner_xml(tag), inner_xml)
AssertionError: u'some text<Bar name="a">Bar A</Bar><Bar name="b">Bar B</Bar>' != '  some text  <Bar name="a">Bar A</Bar>  <Bar name="b">Bar B</Bar>'

----------------------------------------------------------------------
Ran 57 tests in 1.338s

FAILED (errors=1, failures=1)
Dziolas commented 10 years ago

Try it now <3

jalavik commented 10 years ago

Merged as a82aeae