Files
concrete/tests/common/debugging/test_drawing.py
Arthur Meyre 48aaed9ee8 refactor: disallow tuple input in inputset for 1-input functions
- handle the case properly once we add tuple support in #772

closes #971
2021-12-02 11:59:42 +01:00

30 lines
918 B
Python

"""Test file for drawing"""
import tempfile
from pathlib import Path
from concrete.common.data_types.integers import Integer
from concrete.common.debugging import draw_graph
from concrete.common.values import EncryptedScalar
from concrete.numpy.compile import compile_numpy_function_into_op_graph_and_measure_bounds
def test_draw_graph_with_saving(default_compilation_configuration):
"""Tests drawing and saving a graph"""
def function(x):
return x + 42
op_graph = compile_numpy_function_into_op_graph_and_measure_bounds(
function,
{"x": EncryptedScalar(Integer(7, True))},
range(-5, 5),
default_compilation_configuration,
)
with tempfile.TemporaryDirectory() as tmp:
output_directory = Path(tmp)
output_file = output_directory.joinpath("test.png")
draw_graph(op_graph, save_to=output_file)
assert output_file.exists()