Welcome to klara’s documentation!


Klara is still in early experimental stage, notable missing features are loop, comprehension, module import, exceptions and many more. See limitation for full list. It probably will not run on real world projects, so it’s best to cherry-pick a few interesting functions to generate the corresponding test case.

Klara is a static analysis tools to automatically generate test cases, based on an SMT solver (z3), with a powerful AST level inference system. Klara will take a python file as input and generate a corresponding test file in pytest format, that attempts to cover all return values of the input file’s functions. For example, the following function in file test.py:

def triangle(x: int, y: int, z: int) -> str:
    if x == y == z:
        return "Equilateral triangle"
    elif x == y or y == z or x == z:
        return "Isosceles triangle"
        return "Scalene triangle"

will generate:

import test

def test_triangle_0():
    assert test.triangle(0, 0, 0) == 'Equilateral triangle'
    assert test.triangle(0, 0, 1) == 'Isosceles triangle'
    assert test.triangle(2, 0, 1) == 'Scalene triangle'

The User Guide

The sections here will explain how to install and use Klara, and include steps for extending Klara.

The Contributor Guide

The sections here will explain the internals workings of Klara


Documentations for modules, classes and functions.

Indices and tables