def test__multiple_with_real_parser(self):
    api = MockOCLCClassifyAPI(self._db)
    for filename in ('single_work_48446512.xml', 'single_work_48525129.xml'):
        api.queue_response(sample_data(filename, 'oclc_classify'))
    provider = IdentifierLookupCoverageProvider(self._default_collection, api=api)
    (tree, identifier) = (self._tree('multi'), self._id('multi'))
    metadata = self._blank_metadata(identifier)
    (code, owi_data) = provider.parser.initial_look_up(tree)
    result = provider._multiple(owi_data, metadata)
    assert (['http://classify.oclc.org/classify2/Classify?owi=48446512', 'http://classify.oclc.org/classify2/Classify?owi=48525129'] == api.requests)
    assert isinstance(result, Metadata)
    assert (result._data_source == 'OCLC Classify')
    assert (result.primary_identifier == identifier)
    expected_author_info = ('Adams, Douglas', 'n80076765', '113230702', ['Author'], {'deathDate': '2001', 'birthDate': '1952'})
    [author] = result.contributors
    author_info = self._get_contributor_info(author)
    assert (author_info == expected_author_info)
    self._check_measurements(result.measurements, 'multi')
    ([ddc], [lcc], fast) = self._get_subjects(result.subjects)
    assert (ddc.identifier == '823.914')
    assert (lcc.identifier == 'PR6051.D3352')
    fast_work_1 = set(['Dent, Arthur (Fictitious character)', 'Prefect, Ford', 'Interplanetary voyages', 'Interstellar travel', 'Fiction'])
    fast_work_2 = set(['Dent, Arthur (Fictitious character)', 'Prefect, Ford', 'Interplanetary voyages', 'Interstellar travel', 'Science fiction, English', 'Humorous stories, English'])
    assert (len(fast) == 7)
    fast_subject_names = set([x.name for x in fast])
    assert (fast_subject_names == fast_work_1.union(fast_work_2))
def test__multiple_with_real_parser(self):
    api = MockOCLCClassifyAPI(self._db)
    for filename in ('single_work_48446512.xml', 'single_work_48525129.xml'):
        api.queue_response(sample_data(filename, 'oclc_classify'))
    provider = IdentifierLookupCoverageProvider(self._default_collection, api=api)
    (tree, identifier) = (self._tree('multi'), self._id('multi'))
    metadata = self._blank_metadata(identifier)
    (code, owi_data) = provider.parser.initial_look_up(tree)
    result = provider._multiple(owi_data, metadata)
    assert (['http://classify.oclc.org/classify2/Classify?owi=48446512', 'http://classify.oclc.org/classify2/Classify?owi=48525129'] == api.requests)
    assert isinstance(result, Metadata)
    assert (result._data_source == 'OCLC Classify')
    assert (result.primary_identifier == identifier)
    expected_author_info = ('Adams, Douglas', 'n80076765', '113230702', ['Author'], {'deathDate': '2001', 'birthDate': '1952'})
    [author] = result.contributors
    author_info = self._get_contributor_info(author)
    assert (author_info == expected_author_info)
    self._check_measurements(result.measurements, 'multi')
    ([ddc], [lcc], fast) = self._get_subjects(result.subjects)
    assert (ddc.identifier == '823.914')
    assert (lcc.identifier == 'PR6051.D3352')
    fast_work_1 = set(['Dent, Arthur (Fictitious character)', 'Prefect, Ford', 'Interplanetary voyages', 'Interstellar travel', 'Fiction'])
    fast_work_2 = set(['Dent, Arthur (Fictitious character)', 'Prefect, Ford', 'Interplanetary voyages', 'Interstellar travel', 'Science fiction, English', 'Humorous stories, English'])
    assert (len(fast) == 7)
    fast_subject_names = set([x.name for x in fast])
    assert (fast_subject_names == fast_work_1.union(fast_work_2))