def process_pmc(pmc_id): xml_str = pmc_client.get_xml(pmc_id) with tempfile.NamedTemporaryFile() as fh: fh.write(xml_str) fh.flush() rp = process_nxml(fh.name) return rp
def process_pmc(pmc_id): if pmc_id.upper().startswith('PMC'): pmc_id = pmc_id[3:] xml_str = pmc_client.get_xml(pmc_id) if xml_str is None: return None with tempfile.NamedTemporaryFile() as fh: fh.write(xml_str) fh.flush() rp = process_nxml(fh.name) return rp
def test_get_xml_invalid(): pmc_id = '9999999' xml_str = pmc_client.get_xml(pmc_id) assert(xml_str is None)
def test_get_xml(): pmc_id = '4322985' xml_str = pmc_client.get_xml(pmc_id) assert(xml_str is not None)
def test_get_xml_invalid(): pmc_id = '9999999' xml_str = pmc_client.get_xml(pmc_id) assert (xml_str is None)
def test_get_xml(): pmc_id = '4322985' xml_str = pmc_client.get_xml(pmc_id) assert (xml_str is not None)