Skip to content

Commit 185a64d

Browse files
committed
armor_names method now accepts PQType enum as optional argument
1 parent 359e05f commit 185a64d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

quantcrypt/internal/constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ def iterate(cls) -> Iterator[AlgoSpec]:
113113
yield value
114114

115115
@classmethod
116-
def armor_names(cls) -> list[str]:
117-
return [spec.armor_name() for spec in cls.iterate()]
116+
def armor_names(cls, pqa_type: PQAType | None = None) -> list[str]:
117+
return [spec.armor_name() for spec in cls.iterate()
118+
if not pqa_type or spec.type == pqa_type]
118119

119120

120121
SupportedVariants = [PQAVariant.REF]

tests/test_constants.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ def test_supported_algos():
108108
for item in const.SupportedAlgos.iterate():
109109
assert isinstance(item, const.AlgoSpec)
110110

111-
armor_names = const.SupportedAlgos.armor_names()
112-
assert isinstance(armor_names, list)
113-
assert all([isinstance(n, str) for n in armor_names])
111+
for pqa_type in [None, *const.PQAType.members()]:
112+
armor_names = const.SupportedAlgos.armor_names(pqa_type)
113+
assert isinstance(armor_names, list)
114+
assert all([isinstance(n, str) for n in armor_names])
114115

115116

116117
def test_pqclean_repo_archive_url():

0 commit comments

Comments
 (0)