tests.unit_tests.db.test_yawning_titan_db.DemoDB#
- class tests.unit_tests.db.test_yawning_titan_db.DemoDB(name)[source]#
Bases:
YawningTitanDB
An implementation of
YawningTitanDB
.Methods
Get all docs.
Close the db.
Count how many docs are in the db.
Get a dog from its uuid.
Insert a doc and return the inserted doc.
Check whether a doc is locked for editing or not.
Remove a document with a given uuid.
Remove documents matching a query.
Search for docs using Query.
Show details of all entries in the db.
Update a doc by uuid.
Upsert a doc by uuid.
Attributes
- insert(doc, name=None, description=None, author=None)[source]#
Insert a doc and return the inserted doc.
- close()#
Close the db.
- count(cond=None)#
Count how many docs are in the db. Extends
tinydb.table.Table.count
.A
YawningTitanQuery
can be used to filter the count.- Parameters:
cond – An optional
YawningTitanQuery
. Has a default value ofNone
.- Returns:
The number of docs counted.
- classmethod is_locked(doc)#
Check whether a doc is locked for editing or not.
- Parameters:
doc – A doc.
- Returns:
True
if the doc is locked, otherwiseFalse
.
- property name#
The DB name.
- show(verbose=False)#
Show details of all entries in the db.
- Parameters:
verbose – If True, all doc metadata details are shown, otherwise just the name is shown.