mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-27 04:54:21 +01:00
27 lines
584 B
Python
Executable File
27 lines
584 B
Python
Executable File
#!/usr/bin/env -S python3 -u
|
|
|
|
import turso
|
|
from antithesis.assertions import always
|
|
|
|
try:
|
|
con = turso.connect("bank_test.db")
|
|
except Exception as e:
|
|
print(f"Error connecting to database: {e}")
|
|
exit(0)
|
|
|
|
cur = con.cursor()
|
|
|
|
initial_state = cur.execute("""
|
|
SELECT * FROM initial_state
|
|
""").fetchone()
|
|
|
|
curr_total = cur.execute("""
|
|
SELECT SUM(balance) AS total FROM accounts;
|
|
""").fetchone()
|
|
|
|
always(
|
|
initial_state[1] == curr_total[0],
|
|
"[Finally] Initial balance always equals current balance",
|
|
{"init_bal": initial_state[1], "curr_bal": curr_total[0]},
|
|
)
|