def test_repair_do_nothing(): item = Item('BEGIN:VCARD\nUID:justfine\nEND:VCARD') assert repair_item('fine', item, set(), True) is item assert repair_item('@@@@/fine', item, set(), True) is item
def test_repair_irreparable(raw): with pytest.raises(IrreparableItem): repair_item('fine', Item(raw), set(), True)
def test_repair_unsafe_href(uid, href): item = Item('BEGIN:VCARD\nUID:{}\nEND:VCARD'.format(uid)) new_item = repair_item(href, item, set(), True) assert new_item.raw != item.raw assert new_item.uid != item.uid assert href_safe(new_item.uid)
def test_repair_do_nothing(): item = Item("BEGIN:VCARD\nUID:justfine\nEND:VCARD") assert repair_item("fine", item, set(), True) is item assert repair_item("@@@@/fine", item, set(), True) is item