Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
341cbb01
Commit
341cbb01
authored
11 months ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
2c61a517
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Pipeline
#51350
passed with warnings
11 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/caoscrawler/identifiable.py
+5
-5
5 additions, 5 deletions
src/caoscrawler/identifiable.py
src/caoscrawler/identifiable_adapters.py
+1
-1
1 addition, 1 deletion
src/caoscrawler/identifiable_adapters.py
unittests/test_sync_node.py
+6
-11
6 additions, 11 deletions
unittests/test_sync_node.py
with
12 additions
and
17 deletions
src/caoscrawler/identifiable.py
+
5
−
5
View file @
341cbb01
#!/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.
"""
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/identifiable_adapters.py
+
1
−
1
View file @
341cbb01
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
unittests/test_sync_node.py
+
6
−
11
View file @
341cbb01
...
...
@@ -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
'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment