Skip to content

Commit

Permalink
Modify a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Feb 20, 2020
1 parent 9f341d4 commit 7c4ab91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/test_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from simplesqlite import connect_memdb
from simplesqlite.model import Blob, Integer, Model, Real, Text
from simplesqlite.query import Where


class Hoge(Model):
Expand All @@ -23,6 +24,7 @@ def test_orm():

Hoge.attach(con, is_hidden=True)
Hoge.create()
assert Hoge.fetch_num_records() == 0
hoge_inputs = [Hoge(hoge_id=10, name="a"), Hoge(hoge_id=20, name="b")]
for hoge_input in hoge_inputs:
Hoge.insert(hoge_input)
Expand All @@ -33,8 +35,12 @@ def test_orm():
for foo_input in foo_inputs:
Foo.insert(foo_input)

assert Hoge.fetch_num_records() == 2
for record, hoge_input in zip(Hoge.select(), hoge_inputs):
assert record == hoge_input

for record, foo_input in zip(Foo.select(), foo_inputs):
assert record == foo_input

result = Hoge.select(where=Where("hoge_id", 999))
assert len(list(result)) == 0

0 comments on commit 7c4ab91

Please sign in to comment.