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
d6af005e
Commit
d6af005e
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
341cbb01
No related branches found
No related tags found
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Pipeline
#51351
passed with warnings
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/exceptions.py
+13
-0
13 additions, 0 deletions
src/caoscrawler/exceptions.py
unittests/test_sync_graph.py
+7
-5
7 additions, 5 deletions
unittests/test_sync_graph.py
with
20 additions
and
5 deletions
src/caoscrawler/exceptions.py
+
13
−
0
View file @
d6af005e
...
...
@@ -21,16 +21,26 @@
#
class
ForbiddenTransaction
(
Exception
):
"""
Thrown if an transactions is needed that is not allowed.
For example an update of an entity if the security level is INSERT
"""
pass
class
MissingReferencingEntityError
(
Exception
):
"""
Thrown if the identifiable requires that some entity references the given entity but there
is no such reference
"""
def
__init__
(
self
,
*
args
,
rts
=
None
,
**
kwargs
):
self
.
rts
=
rts
super
().
__init__
(
self
,
*
args
,
**
kwargs
)
class
ImpossibleMergeError
(
Exception
):
"""
Thrown if due to identifying information, two SyncNodes or two Properties of SyncNodes
should be merged, but there is conflicting information that prevents this.
"""
def
__init__
(
self
,
*
args
,
pname
,
values
,
**
kwargs
):
self
.
pname
=
pname
self
.
values
=
values
...
...
@@ -38,4 +48,7 @@ class ImpossibleMergeError(Exception):
class
MissingIdentifyingProperty
(
Exception
):
"""
Thrown if a SyncNode does not have the properties required by the corresponding registered
identifiable
"""
pass
This diff is collapsed.
Click to expand it.
unittests/test_sync_graph.py
+
7
−
5
View file @
d6af005e
...
...
@@ -37,8 +37,7 @@ from itertools import product
@pytest.fixture
def
simple_adapter
():
# We use the reference as identifying reference in both directions. Thus the map is the same
# for all three categories: references, id_references and id_referenced_by
# different RTs with different registered identifiables to allow to test various behavior
ident_adapter
=
CaosDBIdentifiableAdapter
()
ident_adapter
.
register_identifiable
(
"
RT1
"
,
...
...
@@ -166,9 +165,12 @@ def test_SyncGraph_init():
for
el
in
st
.
nodes
:
if
el
.
identifiable
is
not
None
:
assert
st
.
_identifiable_look_up
[
el
.
identifiable
.
get_representation
()]
is
el
# node without ID but with identifiable was merged with other node with ID
assert
len
([
el
for
el
in
st
.
nodes
if
len
(
el
.
properties
)
>
0
and
el
.
properties
[
0
].
value
==
"
MERGEME
"
])
==
1
# The node, which has no ID but has an identifiable, was merged with another node with ID (due
# to the shared identifiable)
new_one
=
[
el
for
el
in
st
.
nodes
if
len
(
el
.
properties
)
>
0
and
el
.
properties
[
0
].
value
==
"
MERGEME
"
]
assert
len
(
new_one
)
==
1
assert
new_one
[
0
].
id
==
104
# every node that does not rely on something unchecked has an identifiable or an ID
for
el
in
st
.
nodes
:
if
not
st
.
_identity_relies_on_unchecked_entity
(
el
):
...
...
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