def test_csl_item_standardize_id_note(): """ Test extracting standard_id from a note and setting additional note fields. """ csl_item = CSL_Item({ 'id': 'original-id', 'type': 'article-journal', 'note': 'standard_id: doi:10.1371/journal.PPAT.1006256', }) csl_item.standardize_id() assert csl_item['id'] == 'doi:10.1371/journal.ppat.1006256' note_dict = csl_item.note_dict assert note_dict['original_id'] == 'original-id' assert note_dict['original_standard_id'] == 'doi:10.1371/journal.PPAT.1006256'
def test_csl_item_standardize_id_note(): """ Test extracting standard_id from a note and setting additional note fields. """ csl_item = CSL_Item({ "id": "original-id", "type": "article-journal", "note": "standard_id: doi:10.1371/journal.PPAT.1006256", }) csl_item.standardize_id() assert csl_item["id"] == "doi:10.1371/journal.ppat.1006256" note_dict = csl_item.note_dict assert note_dict["original_id"] == "original-id" assert note_dict[ "original_standard_id"] == "doi:10.1371/journal.PPAT.1006256"
def test_csl_item_standardize_id(csl_item, standard_citation): csl_item = CSL_Item(csl_item) output = csl_item.standardize_id() assert output is csl_item assert output["id"] == standard_citation
def test_csl_item_standardize_id_repeated(): csl_item = CSL_Item(id="pmid:1", type="article-journal") csl_item_1 = copy.deepcopy(csl_item.standardize_id()) assert "standard_citation" not in "csl_item" csl_item_2 = copy.deepcopy(csl_item.standardize_id()) assert csl_item_1 == csl_item_2
def test_csl_item_standardize_id_repeated(): csl_item = CSL_Item(id='pmid:1', type='article-journal') csl_item_1 = copy.deepcopy(csl_item.standardize_id()) assert 'standard_citation' not in 'csl_item' csl_item_2 = copy.deepcopy(csl_item.standardize_id()) assert csl_item_1 == csl_item_2