CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-crosshair-tool

Analyze Python code for correctness using symbolic execution and SMT solving to automatically find counterexamples for functions with type annotations and contracts.

86

1.24x
Overview
Eval results
Files

task.mdevals/scenario-10/

Test Suite Generator

A utility that automatically generates comprehensive test suites for Python functions to maximize code coverage.

Capabilities

Generate test suite with high coverage

  • Given a Python module containing a function calculate_grade(score: int) -> str that returns "A" for scores >= 90, "B" for scores >= 80, "C" for scores >= 70, "D" for scores >= 60, and "F" otherwise, generate a test file that achieves complete branch coverage @test

  • Given a Python module with a function process_data(items: list, threshold: int) -> list that filters items greater than threshold and raises ValueError if items is empty, generate a test file that covers all execution paths including the exception case @test

  • Given a Python module with a function validate_email(email: str) -> bool that checks if an email contains "@" and ".", generate a test file with tests formatted as complete pytest functions @test

Execute coverage generation command

  • The implementation successfully invokes the coverage generation mechanism and captures the generated test outputs @test

Implementation

@generates

API

def generate_tests(module_path: str, output_path: str) -> bool:
    """
    Generates a comprehensive test suite for the given Python module.

    Args:
        module_path: Path to the Python module to generate tests for
        output_path: Path where the generated test file should be written

    Returns:
        bool: True if test generation was successful, False otherwise
    """
    pass

Dependencies { .dependencies }

crosshair-tool { .dependency }

Provides automatic test generation with coverage analysis using symbolic execution.

Install with Tessl CLI

npx tessl i tessl/pypi-crosshair-tool

tile.json