Analyze Python code for correctness using symbolic execution and SMT solving to automatically find counterexamples for functions with type annotations and contracts.
86
A user account management system that validates user operations using runtime contract enforcement.
@generates
class UserAccount:
"""
A user account with username, age, and balance.
Attributes:
username: Alphanumeric string, 3-20 characters
age: Integer between 18 and 120 (inclusive)
balance: Non-negative float
"""
def __init__(self, username: str, age: int) -> None:
"""
Create a new user account.
Args:
username: The username for the account
age: The user's age
"""
pass
def deposit(self, amount: float) -> None:
"""
Deposit money into the account.
Args:
amount: The amount to deposit
"""
pass
def withdraw(self, amount: float) -> None:
"""
Withdraw money from the account.
Args:
amount: The amount to withdraw
"""
pass
def update_username(self, new_username: str) -> None:
"""
Update the account's username.
Args:
new_username: The new username
"""
passProvides runtime contract enforcement with decorators for validating preconditions and postconditions.
Install with Tessl CLI
npx tessl i tessl/pypi-crosshair-toolevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10