def test_lettermetadata_unquotes_special_keys(): metadata = LetterMetadata({ "filename": "%C2%A3hello", "recipient": "%C2%A3hi" }) assert metadata.get("filename") == "£hello" assert metadata.get("recipient") == "£hi"
def test_lettermetadata_gets_non_special_keys(): metadata = LetterMetadata({"key": "value", "not_key_to_decode": "%C2%A3"}) assert metadata.get("key") == "value" assert metadata.get("other_key") is None assert metadata.get("other_key", "default") == "default" assert metadata.get("not_key_to_decode") == "%C2%A3"