File size: 439 Bytes
b91943a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
from data_examples.example_code import factorial
from inference import CodeExplainViz

def test_explain_and_viz_runs():
    with open("data_examples/example_code.py", "r", encoding="utf-8") as f:
        code = f.read()
    expl = CodeExplainViz()
    out = expl.explain(code)
    assert "mermaid" in out
    assert out["mermaid"].startswith("flowchart")
    assert isinstance(out["short"], str)
    assert len(out["short"]) > 0