Skip to content

Commit

Permalink
Add unit test to check python attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Iyán Méndez Veiga <[email protected]>
  • Loading branch information
iyanmv committed Jan 23, 2025
1 parent 014d7c2 commit d5effde
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ def test_not_enabled():
raise AssertionError(f"An unexpected exception was raised: {ex}")


def test_python_attributes():
for alg_name in oqs.get_enabled_sig_mechanisms():
sig = oqs.Signature(alg_name)
if sig.method_name.decode() != alg_name:
raise AssertionError("Incorrect oqs.Signature.method_name")
if sig.alg_version is None:
raise AssertionError("Undefined oqs.Signature.alg_version")
if not 1 <= sig.claimed_nist_level <= 5:
raise AssertionError("Invalid oqs.Signature.claimed_nist_level")
if sig.length_public_key == 0:
raise AssertionError("Incorrect oqs.Signature.length_public_key")
if sig.length_secret_key == 0:
raise AssertionError("Incorrect oqs.Signature.length_secret_key")
if sig.length_signature == 0:
raise AssertionError("Incorrect oqs.Signature.length_signature")


if __name__ == "__main__":
try:
import nose2
Expand Down

0 comments on commit d5effde

Please sign in to comment.