Example #1
0
 def test_subjects_xml(self, item, expected):
     filename = os.path.dirname(
         __file__) + '/test_data/xml_input/' + item + '_marc.xml'
     element = etree.parse(filename).getroot()
     if element.tag != record_tag and element[0].tag == record_tag:
         element = element[0]
     rec = MarcXml(element)
     assert read_subjects(rec) == expected
Example #2
0
    def test_subjects_bin(self, item, expected):
        filename = os.path.dirname(__file__) + '/test_data/bin_input/' + item

        data = open(filename).read()
        if len(data) != int(data[:5]):
            data = data.decode('utf-8').encode('raw_unicode_escape')
        rec = MarcBinary(data)
        assert read_subjects(rec) == expected
Example #3
0
 def test_subjects_bin(self, item, expected):
     filename = os.path.dirname(__file__) + '/test_data/bin_input/' + item
     with open(filename, mode='rb') as f:
         rec = MarcBinary(f.read())
     assert read_subjects(rec) == expected