chore(keyringctl): add test for simplify_ascii
This commit is contained in:
parent
83a345a1b8
commit
e8fb9d17b3
@ -292,8 +292,6 @@ ascii_mapping: Dict[str, str] = {
|
|||||||
ascii_mapping_lookup: Dict[str, str] = {}
|
ascii_mapping_lookup: Dict[str, str] = {}
|
||||||
for key, value in ascii_mapping.items():
|
for key, value in ascii_mapping.items():
|
||||||
for c in key:
|
for c in key:
|
||||||
if c in ascii_mapping_lookup:
|
|
||||||
raise Exception(f"duplicate ascii mapping: {c}")
|
|
||||||
ascii_mapping_lookup[c] = value
|
ascii_mapping_lookup[c] = value
|
||||||
ascii_mapping_lookup[c.upper()] = value.upper()
|
ascii_mapping_lookup[c.upper()] = value.upper()
|
||||||
|
|
||||||
|
@ -181,3 +181,18 @@ def test_filter_fingerprints_by_trust(
|
|||||||
trusts: Dict[Fingerprint, Trust], trust: Trust, result: List[Fingerprint]
|
trusts: Dict[Fingerprint, Trust], trust: Trust, result: List[Fingerprint]
|
||||||
) -> None:
|
) -> None:
|
||||||
assert util.filter_fingerprints_by_trust(trusts=trusts, trust=trust) == result
|
assert util.filter_fingerprints_by_trust(trusts=trusts, trust=trust) == result
|
||||||
|
|
||||||
|
|
||||||
|
@mark.parametrize(
|
||||||
|
"_str, result",
|
||||||
|
[
|
||||||
|
("foobar", "foobar"),
|
||||||
|
("", ""),
|
||||||
|
("bbàáâãğț aa", "bbaaaagt_aa"),
|
||||||
|
("<>", ""),
|
||||||
|
("!#$%^&*()_☃", "___________"),
|
||||||
|
("_-.+@", "_-.+@"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_simplify_ascii(_str: str, result: str) -> None:
|
||||||
|
assert util.simplify_ascii(_str=_str) == result
|
||||||
|
Loading…
Reference in New Issue
Block a user