Initial implementation of table.get(...)

This commit is contained in:
Simon Willison 2019-07-14 12:22:43 -07:00
commit a9fd1e785f
2 changed files with 41 additions and 0 deletions

View file

@ -1,6 +1,20 @@
import pytest
def test_get_rowid(fresh_db):
dogs = fresh_db["dogs"]
cleo = {"name": "Cleo", "age": 4}
row_id = dogs.insert(cleo).last_rowid
assert cleo == dogs.get(row_id)
def test_get_primary_key(fresh_db):
dogs = fresh_db["dogs"]
cleo = {"name": "Cleo", "age": 4, "id": 5}
row_id = dogs.insert(cleo, pk="id").last_pk
assert cleo == dogs.get(5)
@pytest.mark.parametrize(
"where,where_args,expected_ids",
[