def test_full_title(): assert full_title({'title': "Hamlet"}) == "Hamlet" edition = { 'title': 'Flatland', 'subtitle': 'A Romance of Many Dimensions', } assert full_title(edition) == "Flatland A Romance of Many Dimensions"
def test_merge_titles2(): amazon = {'title': u'Sea Birds Britain Ireland'} marc = { 'title_with_subtitles': u'seabirds of Britain and Ireland', 'title': u'seabirds of Britain and Ireland', 'full_title': u'The seabirds of Britain and Ireland', } amazon = build_titles(full_title(amazon)) marc = build_titles(marc['title_with_subtitles']) assert compare_title(amazon, marc) == ('full-title', 'exact match', 600)
def test_merge_titles(): marc = { 'title_with_subtitles': 'Spytime : the undoing of James Jesus Angleton : a novel', 'title': 'Spytime', 'full_title': 'Spytime : the undoing of James Jesus Angleton : a novel', } amazon = { 'subtitle': 'The Undoing oF James Jesus Angleton', 'title': 'Spytime', } amazon = build_titles(full_title(amazon)) marc = build_titles(marc['title_with_subtitles']) assert amazon['short_title'] == marc['short_title'] assert compare_title(amazon, marc) == ('full-title', 'contained within other title', 350)