def test_get_pubmed_item(): # this one exists qid = PubmedItem(27528457).get_or_create() assert qid == "Q27098545" qid = PubmedItem("4986259", id_type="PMC").get_or_create() assert qid == "Q27098545" qid = PubmedItem("10.1186/S12864-016-2855-3", id_type="DOI").get_or_create() assert qid == "Q27098545"
def run(ext_id, id_type='MED'): try: p = PubmedItem(ext_id, id_type) qid = p.get_or_create(login) except Exception as e: traceback.print_exc() return flask.jsonify({'success': False, 'message': str(e)}) if qid: return flask.jsonify({ 'success': True, 'result': qid, 'errors': p.errors, 'warnings': p.warnings }) else: return flask.jsonify({ 'success': False, 'errors': p.errors, 'warnings': p.warnings })
def test_pubmedstub_bad_pmid(): # invalid pubmed id wdid = PubmedItem(999999999).get_or_create(login='******') assert wdid is None
def test_get_pubmed_item_cache(): # this one exists wdid = PubmedItem(1234).get_or_create() assert ('1234', 'MED') in PubmedItem._cache assert PubmedItem._cache[('1234', 'MED')] == "Q27442302"
def test_get_pmc_item(): # only has a pmc id qid = PubmedItem("PMC3425984", id_type='PMC').get_or_create() assert qid == "Q42758027"
def test_get_pubmed_item(): # this one exists wdid = PubmedItem(1234).get_or_create() assert wdid == "Q27442302"