-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtest_deprecated.py
More file actions
33 lines (27 loc) · 1.01 KB
/
test_deprecated.py
File metadata and controls
33 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import tests.common
from objectbox import ObjectBox
from objectbox.c import *
from objectbox.model.idsync import sync_model
from objectbox.store_options import StoreOptions
from tests.common import *
def test_deprecated_ObjectBox():
Store.remove_db_files("testdata")
remove_json_model_file()
model = tests.common.create_default_model()
sync_model(model) # It expects IDs to be already assigned
options = StoreOptions()
options.model(model)
options.directory("testdata")
c_store = obx_store_open(options._c_handle)
with pytest.deprecated_call():
ob = ObjectBox(c_store)
box = objectbox.Box(ob, TestEntity)
assert box.count() == 0
ob.close() # TODO The store shall be closed even if the test fails
def test_deprecated_Builder():
Store.remove_db_files("testdata")
remove_json_model_file()
model = tests.common.create_default_model()
with pytest.deprecated_call():
ob = objectbox.Builder().model(model).directory("testdata").build()
ob.close()