Skip to content
Snippets Groups Projects
Commit 6969c848 authored by Alexander Kreft's avatar Alexander Kreft
Browse files

up

parent 7b4582bb
No related branches found
No related tags found
1 merge request!19ENH: add resolve_value to Property
......@@ -29,7 +29,7 @@
import caosdb as db
import pickle
import tempfile
from caosdb.apiutils import apply_to_ids, id_query
from caosdb.apiutils import apply_to_ids, create_id_query, retrieve_entity_with_id
from .test_property import testrecord
......@@ -63,7 +63,17 @@ def test_apply_to_ids():
assert rec.properties[0].id == -23345
assert rec.id == -23
originalfunc = db.execute_query
db.execute_query = lambda q: q
def test_id_query():
assert id_query([1]) == 1
ids = [1,2,3,4,5]
assert create_id_query(ids) == 'FIND ENTITY WITH ID=1 OR ID=2 OR ID=3 OR ID=4 OR ID=5'
original_retrieve_entity_with_id = retrieve_entity_with_id
retrieve_entity_with_id = lambda eid: db.Record(id=eid)
def test_resolve_reference():
prop = db.Property(id = 1, datatype=db.REFERENCE, value=100)
prop_list = [db.Property(id = 2, datatype=db.REFERENCE, value=200),
db.Property(id = 3, datatype=db.REFERENCE, value=300),
db.Property(id = 4, datatype=db.Integer, value=400)
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment