Skip to content
Snippets Groups Projects
Commit 341cbb01 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 2c61a517
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!167Sync Graph
Pipeline #51350 passed with warnings
#!/usr/bin/env python3
# encoding: utf-8
#
# This file is a part of the CaosDB Project.
# This file is a part of the LinkAhead Project.
#
# Copyright (C) 2022 Henrik tom Wörden
#
......@@ -37,10 +37,10 @@ logger = logging.getLogger(__name__)
class Identifiable():
"""
The fingerprint of a Record in CaosDB.
The fingerprint of a Record in LinkAhead.
This class contains the information that is used by the CaosDB Crawler to identify Records.
In order to check whether a Record exits in the CaosDB Server, a query can
This class contains the information that is used by the LinkAhead Crawler to identify Records.
In order to check whether a Record exits in the LinkAhead Server, a query can
be created using the information contained in the Identifiable.
Parameters
......@@ -84,7 +84,7 @@ class Identifiable():
def _value_representation(value) -> str:
"""returns the string representation of property values to be used in the hash function
The string is the CaosDB ID in case of SyncNode objects (SyncNode objects must have an ID)
The string is the LinkAhead ID in case of SyncNode objects (SyncNode objects must have an ID)
and the string representation of None, bool, float, int, datetime and str.
"""
......
......@@ -2,7 +2,7 @@
# encoding: utf-8
#
# ** header v3.0
# This file is a part of the CaosDB Project.
# This file is a part of the LinkAhead Project.
#
# Copyright (C) 2021-2022 Henrik tom Wörden
# 2021-2022 Alexander Schlemmer
......
......@@ -129,10 +129,6 @@ def test_sync_node():
assert export.name == rec_a.name
for p in rec_a.parents + rec_b.parents:
assert parent_in_list(p, export.parents)
# if p.name is not None:
# assert p.name in [el.name for el in export.parents]
# if p.id is not None:
# assert p.id in [el.id for el in export.parents]
for p in rec_a.properties + rec_b.properties:
if p.name is not None:
assert p.name in [el.name for el in export.properties]
......@@ -170,33 +166,32 @@ def test_sync_node():
# merge with conflicting information
# ----------------------------------
# ID mismatch
sn_a = SyncNode(db.Record(id=102))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(SyncNode(db.Record(id=101)))
# name mismatch
sn_a = SyncNode(db.Record(name='102'))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(SyncNode(db.Record(name='101')))
# type mismatch
sn_a = SyncNode(db.Record(name='102'))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(SyncNode(db.File(name='102')))
# description mismatch
sn_a = SyncNode(db.Record(description='102'))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(SyncNode(db.Record(description='101')))
# path mismatch
sn_a = SyncNode(db.File(path='102'))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(SyncNode(db.File(path='101')))
sn_a = SyncNode(db.File(path='102'))
sn_a.identifiable = Identifiable(name='a')
# sn_b.identifiable = Identifiable(name='b')
sn_b = SyncNode(db.File(path='101'))
with pytest.raises(ValueError, match="Trying to update"):
sn_a.update(sn_b)
# identifiable mismatch
sn_a = SyncNode(db.File(path='102'))
sn_a.identifiable = Identifiable(name='a')
sn_b = SyncNode(db.File(path='101'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment