How to use the hepcrawl.testlib.fixtures.get_node function in hepcrawl

To help you get started, we’ve selected a few hepcrawl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inspirehep / hepcrawl / tests / unit / test_elsevier.py View on Github external
Tracking and viewing changes on the web
                
            
            
            
            
                
                Proc. 1996 USENIX Technical Conference
                
                January 1996
            
            
        
    
    """
    node = get_node(spider, '/doc', text=body)
    return spider.get_references(node)
github inspirehep / hepcrawl / tests / unit / test_edp.py View on Github external
<article xmlns:xlink="http://www.w3.org/1999/xlink">
        
        
        <title>References</title>
            <label>5.</label>R.V. Krishnan, G. Panneerselvam, P. Manikandan M.P. Antony, K. Nagarajan, <source>J. Nucl. Radiochem. Sci., 10.1, 19–26 (2009).

            <label>44.</label>L. Cronin, P. Sojka, A. Lefebvre, <source>SAE Technical Paper, DOI: 10.4271/852086, (1985)

            <label>3.</label>T. Aliyev, Т. Belyaev, S. Gallagher Simulation in ANSYS flow to the gas purification section of the multicomponent gas mixture through the dust cyclone CKBN GP-628. <source>Mechanical engineering, Moscow, №10, (2014).

        
        
    </article>
    """
    response = fake_response_from_string(body)
    node = get_node(spider, "//article", response)[0]

    parsed_item = spider.parse_node(response, node)
    assert parsed_item
    assert parsed_item.record

    return parsed_item.record
github inspirehep / hepcrawl / tests / unit / test_edp.py View on Github external
"""Test parsing when no DOI in record. JATS format."""
    spider = edp_spider.EDPSpider()
    body = """
    <article xmlns:xlink="http://www.w3.org/1999/xlink">
        
            
            aa14485-102010A%26A...516A..97N
                
                    Dielectronic recombination of argon-like ions
                
            
        
    </article>
    """
    response = fake_response_from_string(body)
    node = get_node(spider, "//article", response)[0]

    parsed_item = spider.parse_node(response, node)
    assert parsed_item
    assert parsed_item.record
    record = parsed_item.record

    assert "dois" not in record
    assert isinstance(record, HEPRecord)
github inspirehep / hepcrawl / tests / unit / test_elsevier.py View on Github external
Cognition
                
                37
                
                2
                1975
            
            
                635
                647
            
            
        
    
    """
    node = get_node(spider, '/doc', text=body)
    return spider.get_references(node)
github inspirehep / hepcrawl / tests / unit / test_phenix.py View on Github external
def non_thesis():
    """Return a heprecord for a Master's thesis (should be None as we don't
    want them)."""
    spider = phenix_spider.PhenixSpider()
    body = """
    <ul>
    <li><b>M.Sc. Author</b>:
    "This is an Master's thesis, not a PhD", &nbsp; M.Sc. thesis at Master Science University, 2016,&nbsp;
    <br><br>
    </li></ul>
    """
    response = fake_response_from_string(body)
    node = get_node(spider, '//li', text=body)
    return spider.parse_node(response, node)
github inspirehep / hepcrawl / tests / unit / test_edp.py View on Github external
T. W.
                    
                    1
                
                
                    <label>1</label>
                    Department of Physics, Western Michigan University, Kalamazoo, MI 49008, USA e-mail: gorczyca@wmich.edu
                    
                
            
            
        
    
    """
    response = fake_response_from_string(body)
    node = get_node(spider, "//article", response)[0]

    parsed_item = spider.parse_node(response, node)
    assert parsed_item
    assert parsed_item.record
    record = parsed_item.record

    affiliation = "Department of Physics, Western Michigan University, Kalamazoo, MI 49008, USA"
    assert 'affiliations' in record['authors'][0]
    assert record['authors'][0]['affiliations'][0]['value'] == affiliation
    assert "e-mail" not in record['authors'][0]['affiliations'][0]['value']
    assert record['authors'][0]['email'] is None
github inspirehep / hepcrawl / tests / unit / test_elsevier.py View on Github external
Physics Letters, Section B
                206
                Cumrun Vafa
                
                    
                        Heavy quarkonia
                        Quark gluon plasma
                        Mott effect
                        X(3872)
                    
                
            
        """

        response = fake_response_from_string(body)
        node = get_node(spider, '/doc', response)
        response.meta["xml_url"] = 'elsevier/sample_consyn_record.xml'
        parse_response = spider.parse_node(response, node)
        parse_response.status = 404

        parsed_item = spider.scrape_sciencedirect(parse_response)
        assert parsed_item
        assert parsed_item.record

        return parsed_item.record
github inspirehep / hepcrawl / tests / unit / test_edp.py View on Github external
body = """
    <article xmlns:xlink="http://www.w3.org/1999/xlink">
        
            
            aa14485-102010A%26A...516A..97N
                
                    Dielectronic recombination of argon-like ions
                
                
                
            
        
    </article>
    """
    response = fake_response_from_string(body)
    node = get_node(spider, "//article", response)[0]

    parsed_item = spider.parse_node(response, node)
    assert parsed_item
    assert parsed_item.record
    record = parsed_item.record

    assert "related_article_doi" in record
    assert record["related_article_doi"][0][
        "value"] == "10.1051/0004-6361/201014485"
github inspirehep / hepcrawl / tests / unit / test_elsevier.py View on Github external
Acta Psiquiatrica y Psicologica de America Latina
                
                11
                
                1965
            
            
                321
                330
            
            
        
    
    """
    node = get_node(spider, '/doc', text=body)
    return spider.get_references(node)
github inspirehep / hepcrawl / tests / unit / test_elsevier.py View on Github external
Handbook of teratology
                    
                    Vols. 1-2
                
                
                1977
                
                Plenum Press
                New York
                
            
            
        
    
    """
    node = get_node(spider, '/doc', text=body)
    return spider.get_references(node)