LLM-ADE-dev / tests /test_quality.py
WilliamGazeley
Add simple QA test
1d120a6
raw
history blame
773 Bytes
import sys
import json
from io import StringIO
def test_quality():
"""Tests if the expected functions and values are used"""
with open("qa_questions.json") as f:
qs = json.load(f)
for q in qs:
# Capture stdout
stdout = StringIO()
sys.stdout = stdout
for include in q['includes']:
assert include in stdout.getvalue(), f"Expected {include} in output"
for exclude in q['excludes']:
assert exclude not in stdout.getvalue(), f"Expected {exclude} not in output"
for function in q['functions']:
assert f"Invoking function call {function}" in stdout.getvalue(), f"{function} was not invoked"
# Restore stdout
sys.stdout = sys.__stdout__