Beispiel #1
0
def test_extract_references_from_url():
    path_to_pdf = os.path.join(os.path.dirname(__file__), "data", "1503.07589v1.pdf")
    with open(path_to_pdf, "rb") as fd:
        url = "http://arxiv.org/pdf/1503.07589v1.pdf"
        responses.add(responses.GET, url, body=fd.read(), content_type="application/pdf")

    r = extract_references_from_url(url)
    assert len(r["references"]) == 36
Beispiel #2
0
def test_extract_references_from_url(pdf_files):
    with open(pdf_files[0], 'rb') as fd:
        url = "http://arxiv.org/pdf/1503.07589v1.pdf"
        responses.add(responses.GET,
                      url,
                      body=fd.read(),
                      content_type='application/pdf')

    r = extract_references_from_url(url)
    assert len(r) == 36

    with pytest.raises(FullTextNotAvailableError):
        url = "http://www.example.com"
        responses.add(
            responses.GET,
            url,
            body="File not found!",
            status=404,
            content_type='text/plain',
        )
        extract_references_from_url(url)
Beispiel #3
0
def test_extract_references_from_url():
    path_to_pdf = os.path.join(
        os.path.dirname(__file__),
        'data',
        '1503.07589v1.pdf'
    )
    with open(path_to_pdf, 'rb') as fd:
        url = "http://arxiv.org/pdf/1503.07589v1.pdf"
        responses.add(
            responses.GET,
            url,
            body=fd.read(),
            content_type='application/pdf'
        )

    r = extract_references_from_url(url)
    assert len(r['references']) == 36