Skip to content

Commit d5effde

Browse files
committed
Add unit test to check python attributes
Signed-off-by: Iyán Méndez Veiga <[email protected]>
1 parent 014d7c2 commit d5effde

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_sig.py

+17
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def test_not_enabled():
115115
raise AssertionError(f"An unexpected exception was raised: {ex}")
116116

117117

118+
def test_python_attributes():
119+
for alg_name in oqs.get_enabled_sig_mechanisms():
120+
sig = oqs.Signature(alg_name)
121+
if sig.method_name.decode() != alg_name:
122+
raise AssertionError("Incorrect oqs.Signature.method_name")
123+
if sig.alg_version is None:
124+
raise AssertionError("Undefined oqs.Signature.alg_version")
125+
if not 1 <= sig.claimed_nist_level <= 5:
126+
raise AssertionError("Invalid oqs.Signature.claimed_nist_level")
127+
if sig.length_public_key == 0:
128+
raise AssertionError("Incorrect oqs.Signature.length_public_key")
129+
if sig.length_secret_key == 0:
130+
raise AssertionError("Incorrect oqs.Signature.length_secret_key")
131+
if sig.length_signature == 0:
132+
raise AssertionError("Incorrect oqs.Signature.length_signature")
133+
134+
118135
if __name__ == "__main__":
119136
try:
120137
import nose2

0 commit comments

Comments
 (0)