mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
25 lines
540 B
Python
25 lines
540 B
Python
"""Test file for common python helpers"""
|
|
|
|
from concrete.common.helpers.python_helpers import catch
|
|
|
|
|
|
def test_catch_failure():
|
|
"""Test case for when the function called with catch raises an exception."""
|
|
|
|
def f_fail():
|
|
return 1 / 0
|
|
|
|
assert catch(f_fail) is None
|
|
|
|
|
|
def test_catch():
|
|
"""Test case for catch"""
|
|
|
|
def f(*args, **kwargs):
|
|
return *args, dict(**kwargs)
|
|
|
|
assert catch(f, (1, 2, 3,), **{"one": 1, "two": 2, "three": 3}) == (
|
|
(1, 2, 3),
|
|
{"one": 1, "two": 2, "three": 3},
|
|
)
|