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
2716b228
Commit
2716b228
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
tests pass
parent
2c57c5e6
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!91
Release 0.3
,
!67
MAINT: introduce an identifiable class
Pipeline
#30449
passed
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/caoscrawler/identifiable_adapters.py
+2
-1
2 additions, 1 deletion
src/caoscrawler/identifiable_adapters.py
unittests/records.xml
+133
-133
133 additions, 133 deletions
unittests/records.xml
unittests/test_tool.py
+21
-15
21 additions, 15 deletions
unittests/test_tool.py
with
156 additions
and
149 deletions
src/caoscrawler/identifiable_adapters.py
+
2
−
1
View file @
2716b228
...
...
@@ -197,7 +197,8 @@ class IdentifiableAdapter(metaclass=ABCMeta):
"
Multi properties used in identifiables could cause unpredictable results and are
"
"
not allowed. You might want to consider a Property with a list as value.
"
)
return
Identifiable
(
record_type
=
registered_identifiable
.
parents
[
0
].
name
,
return
Identifiable
(
record_type
=
(
registered_identifiable
.
parents
[
0
].
name
if
registered_identifiable
else
None
),
name
=
record
.
name
,
properties
=
identifiable_props
,
path
=
record
.
path
...
...
This diff is collapsed.
Click to expand it.
unittests/records.xml
+
133
−
133
View file @
2716b228
This diff is collapsed.
Click to expand it.
unittests/test_tool.py
+
21
−
15
View file @
2716b228
...
...
@@ -582,24 +582,30 @@ def reset_mocks(mocks):
def
change_identifiable_prop
(
ident
):
# the checks in here are only to make sure we change the record as we intend to
meas
=
ident
.
_records
[
-
2
]
assert
meas
.
parents
[
0
].
name
==
"
Measurement
"
resps
=
meas
.
properties
[
0
]
assert
resps
.
name
==
"
date
"
# change one element; This changes the date which is part of the identifiable
resps
.
value
=
"
2022-01-04
"
for
ent
in
ident
.
_records
:
if
len
(
ent
.
parents
)
==
0
or
ent
.
parents
[
0
].
name
!=
"
Measurement
"
:
continue
for
prop
in
ent
.
properties
:
if
prop
.
name
!=
"
date
"
:
continue
# change one element; This removes a responsible which is not part of the identifiable
prop
.
value
=
"
2022-01-04
"
return
raise
RuntimeError
(
"
Did not find the property that should be changed.
"
)
def
change_non_identifiable_prop
(
ident
):
# the checks in here are only to make sure we change the record as we intend to
meas
=
ident
.
_records
[
-
1
]
assert
meas
.
parents
[
0
].
name
==
"
Measurement
"
resps
=
meas
.
properties
[
-
1
]
assert
resps
.
name
==
"
responsible
"
assert
len
(
resps
.
value
)
==
2
# change one element; This removes a responsible which is not part of the identifiable
del
resps
.
value
[
-
1
]
for
ent
in
ident
.
_records
:
if
len
(
ent
.
parents
)
==
0
or
ent
.
parents
[
0
].
name
!=
"
Measurement
"
:
continue
for
prop
in
ent
.
properties
:
if
prop
.
name
!=
"
responsible
"
or
len
(
prop
.
value
)
<
2
:
continue
# change one element; This removes a responsible which is not part of the identifiable
del
prop
.
value
[
-
1
]
return
raise
RuntimeError
(
"
Did not find the property that should be changed.
"
)
@patch
(
"
caoscrawler.crawl.Crawler._get_entity_by_id
"
,
...
...
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