Skip to content

Commit

Permalink
Add test showing booleanfield querying.
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Jan 1, 2020
1 parent d1199f7 commit b1bf2b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions walrus/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,19 @@ class Account(BaseModel):
self.assertTrue(huey_db2.active)
self.assertTrue(huey_db2.admin)

def test_query_boolean(self):
class BT(BaseModel):
key = TextField(primary_key=True)
flag = BooleanField(default=False, index=True)

for i in range(4):
BT.create(key='k%s' % i, flag=True if i % 2 else False)

query = BT.query(BT.flag == True)
self.assertEqual([bt.key for bt in query], ['k1', 'k3'])
query = BT.query(BT.flag == False)
self.assertEqual([bt.key for bt in query], ['k0', 'k2'])

def test_uuid(self):
class Beacon(BaseModel):
name = TextField(primary_key=True)
Expand Down

0 comments on commit b1bf2b2

Please sign in to comment.