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
bf5397c8
Commit
bf5397c8
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
TST: add test
parent
efdb10e3
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!160
STY: styling
,
!146
ENH: allow wildcard is_referenced_by
Pipeline
#46659
passed
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/identifiable_adapters.py
+2
-0
2 additions, 0 deletions
src/caoscrawler/identifiable_adapters.py
unittests/test_identifiable_adapters.py
+16
-0
16 additions, 0 deletions
unittests/test_identifiable_adapters.py
with
18 additions
and
0 deletions
src/caoscrawler/identifiable_adapters.py
+
2
−
0
View file @
bf5397c8
...
@@ -221,6 +221,8 @@ identifiabel, identifiable and identified record) for a Record.
...
@@ -221,6 +221,8 @@ identifiabel, identifiable and identified record) for a Record.
for
givenrt
in
prop
.
value
:
for
givenrt
in
prop
.
value
:
found
=
False
found
=
False
if
givenrt
==
"
*
"
:
if
givenrt
==
"
*
"
:
if
id
(
record
)
not
in
referencing_entities
:
continue
for
rt
,
rec
in
referencing_entities
[
id
(
record
)].
items
():
for
rt
,
rec
in
referencing_entities
[
id
(
record
)].
items
():
identifiable_backrefs
.
extend
(
rec
)
identifiable_backrefs
.
extend
(
rec
)
found
=
True
found
=
True
...
...
This diff is collapsed.
Click to expand it.
unittests/test_identifiable_adapters.py
+
16
−
0
View file @
bf5397c8
...
@@ -133,6 +133,22 @@ def test_non_default_name():
...
@@ -133,6 +133,22 @@ def test_non_default_name():
assert
identifiable
.
name
is
None
assert
identifiable
.
name
is
None
def
test_wildcard_ref
():
ident
=
CaosDBIdentifiableAdapter
()
ident
.
register_identifiable
(
"
Person
"
,
db
.
RecordType
()
.
add_parent
(
name
=
"
Person
"
)
.
add_property
(
name
=
"
is_referenced_by
"
,
value
=
[
"
*
"
]))
rec
=
(
db
.
Record
(
name
=
"
don
'
t touch it
"
).
add_parent
(
"
Person
"
)
.
add_property
(
name
=
"
last_name
"
,
value
=
'
Tom
'
))
identifiable
=
ident
.
get_identifiable
(
rec
,
referencing_entities
=
{
id
(
rec
):
{
'
A
'
:
[
db
.
Record
(
id
=
1
).
add_parent
(
"
A
"
)]}}
)
assert
identifiable
.
backrefs
[
0
].
id
==
1
def
test_convert_value
():
def
test_convert_value
():
# test that string representation of objects stay unchanged. No stripping or so.
# test that string representation of objects stay unchanged. No stripping or so.
class
A
():
class
A
():
...
...
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