Skip to content
Snippets Groups Projects

Release 0.3

Merged Florian Spreckelsen requested to merge release-0.3 into main
65 files
+ 4622
1476
Compare changes
  • Side-by-side
  • Inline
Files
65
@@ -33,6 +33,7 @@ import argparse
@@ -33,6 +33,7 @@ import argparse
import sys
import sys
from argparse import RawTextHelpFormatter
from argparse import RawTextHelpFormatter
from caoscrawler import Crawler, SecurityMode
from caoscrawler import Crawler, SecurityMode
 
from caoscrawler.identifiable import Identifiable
import caosdb as db
import caosdb as db
from caoscrawler.identifiable_adapters import CaosDBIdentifiableAdapter
from caoscrawler.identifiable_adapters import CaosDBIdentifiableAdapter
import pytest
import pytest
@@ -106,6 +107,15 @@ def crawler_extended(ident):
@@ -106,6 +107,15 @@ def crawler_extended(ident):
return cr
return cr
 
def test_ambigious_lookup(clear_database, usemodel, crawler, ident):
 
ins, ups = crawler.synchronize()
 
 
proj = db.execute_query("FIND Project WITH identifier='SpeedOfLight'", unique=True)
 
with pytest.raises(RuntimeError, match=".*unambigiously.*"):
 
print(crawler.identifiableAdapter.retrieve_identified_record_for_identifiable(
 
Identifiable(properties={'project': proj.id})))
 
 
def test_single_insertion(clear_database, usemodel, crawler, ident):
def test_single_insertion(clear_database, usemodel, crawler, ident):
ins, ups = crawler.synchronize()
ins, ups = crawler.synchronize()
@@ -114,14 +124,15 @@ def test_single_insertion(clear_database, usemodel, crawler, ident):
@@ -114,14 +124,15 @@ def test_single_insertion(clear_database, usemodel, crawler, ident):
for i in reversed(range(len(res))):
for i in reversed(range(len(res))):
if res[i].parents[0].name == "PyTestInfo":
if res[i].parents[0].name == "PyTestInfo":
del res[i]
del res[i]
filename = rfp("..", "..", "unittests", "records.xml")
# uncomment this to recreate the `records.xml` file
with open(filename, "w") as f:
# filename = rfp("..", "..", "unittests", "records.xml")
xml = res.to_xml()
# with open(filename, "w") as f:
# Remove noscript and transaction benchmark:
# xml = res.to_xml()
for tag in ("noscript", "TransactionBenchmark"):
# # Remove noscript and transaction benchmark:
if xml.find(tag) is not None:
# for tag in ("noscript", "TransactionBenchmark"):
xml.remove(xml.find(tag))
# if xml.find(tag) is not None:
f.write(db.common.utils.xml2str(xml))
# xml.remove(xml.find(tag))
 
# f.write(db.common.utils.xml2str(xml))
assert len(ins) == 18
assert len(ins) == 18
assert len(ups) == 0
assert len(ups) == 0
Loading