Create a Test File
Create a file calledtest_example.py:
test_example.py
Run the Test
Test Discovery
Merit automatically discovers tests in your project:- Test files: Files starting with
test_or ending with_test.py - Test functions: Functions starting with
merit_ - Test classes: Classes starting with
Merit
Add an Async Test
Merit supports async tests for testing async code:test_async.py
Test a Real AI System
Let’s test a simple AI function:test_ai.py
Add AI Assertions
Now add LLM-as-a-Judge assertions (requires API key):test_ai_advanced.py