ext/python: Makes Linter happy

This commit is contained in:
Diego Reis 2025-03-20 17:33:34 -03:00
parent 16b9325830
commit f966f7ad0e
2 changed files with 7 additions and 5 deletions

View file

@ -66,14 +66,15 @@ def test_fetchone_select_max_user_id(provider):
assert max_id
assert max_id == (2,)
# Test case for: https://github.com/tursodatabase/limbo/issues/494
@pytest.mark.parametrize("provider", ["sqlite3", "limbo"])
def test_commit(provider):
con = limbo.connect("sqlite.db")
con = connect(provider, "tests/database.db")
cur = con.cursor()
cur.execute("""
CREATE TABLE IF NOT EXISTS users (
CREATE TABLE IF NOT EXISTS users_b (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
email TEXT NOT NULL,
@ -88,19 +89,20 @@ def test_commit(provider):
("alice", "alice@example.com", "admin"),
("bob", "bob@example.com", "user"),
("charlie", "charlie@example.com", "moderator"),
("diana", "diana@example.com", "user")
("diana", "diana@example.com", "user"),
]
for username, email, role in sample_users:
cur.execute("INSERT INTO users (username, email, role) VALUES (?, ?, ?)", (username, email, role))
cur.execute("INSERT INTO users_b (username, email, role) VALUES (?, ?, ?)", (username, email, role))
con.commit()
# Now query the table
res = cur.execute("SELECT * FROM users")
res = cur.execute("SELECT * FROM users_b")
record = res.fetchone()
assert record
def connect(provider, database):
if provider == "limbo":
return limbo.connect(database)