def test_fragments_by_id__usingwebservice_withbadid(base_url):
with requests_mock.mock() as m:
url = base_url + '/fragments?fragment_ids=foo-bar'
body = {
'detail': "Fragment with identifier 'foo-bar' not found",
'absent_identifiers': ['foo-bar'],
'fragments': [],
'status': 404,
'title': 'Not Found',
'type': 'about:blank'
}
m.get(url, json=body, status_code=404, headers={'Content-Type': 'application/problem+json'})
with pytest.raises(IncompleteFragments) as e:
frag_ids = pd.Series(['foo-bar'])
fragments_by_id(frag_ids, base_url)
assert e.value.fragments.empty
assert e.value.absent_identifiers == ['foo-bar']
评论列表
文章目录