mirror of
https://github.com/luxfhe/ml-sdk.git
synced 2026-10-30 18:13:04 +00:00
Machine Learning with FHE - fork of Zama Concrete-ML - Built-in FHE-friendly ML models - scikit-learn compatible API - PyTorch model conversion - Quantization-aware training
34 lines
982 B
Python
34 lines
982 B
Python
"""Test custom assert functions."""
|
|
|
|
import pytest
|
|
|
|
from concrete.ml.common.debugging.custom_assert import assert_false, assert_not_reached, assert_true
|
|
|
|
|
|
def test_assert_not_functions():
|
|
"""Test custom assert functions"""
|
|
assert_true(True, "one check")
|
|
assert_false(False, "another check")
|
|
|
|
with pytest.raises(AssertionError) as excinfo:
|
|
assert_not_reached("yet another one")
|
|
|
|
assert "yet another one" in str(excinfo.value)
|
|
|
|
with pytest.raises(AssertionError) as excinfo:
|
|
assert_true(False, "one failing check")
|
|
|
|
assert "one failing check" in str(excinfo.value)
|
|
|
|
with pytest.raises(AssertionError) as excinfo:
|
|
assert_false(True, "another failing check")
|
|
|
|
assert "another failing check" in str(excinfo.value)
|
|
|
|
# With specific errors
|
|
with pytest.raises(ValueError):
|
|
assert_true(False, "another check", ValueError)
|
|
|
|
with pytest.raises(ValueError):
|
|
assert_false(True, "another check", ValueError)
|