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
96f47214
Commit
96f47214
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
TST: add a failing test
parent
d7d81141
No related branches found
No related tags found
2 merge requests
!160
STY: styling
,
!157
FIX Yet another corner case of referencing resolution resolved
Pipeline
#47722
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_crawler.py
+18
-1
18 additions, 1 deletion
unittests/test_crawler.py
with
18 additions
and
1 deletion
unittests/test_crawler.py
+
18
−
1
View file @
96f47214
...
@@ -38,6 +38,7 @@ import linkahead as db
...
@@ -38,6 +38,7 @@ import linkahead as db
import
linkahead.common.models
as
dbmodels
import
linkahead.common.models
as
dbmodels
import
pytest
import
pytest
import
yaml
import
yaml
from
caosadvancedtools.models.parser
import
parse_model_from_string
from
caoscrawler.crawl
import
(
Crawler
,
SecurityMode
,
TreatedRecordLookUp
,
from
caoscrawler.crawl
import
(
Crawler
,
SecurityMode
,
TreatedRecordLookUp
,
_treat_deprecated_prefix
,
crawler_main
,
_treat_deprecated_prefix
,
crawler_main
,
split_restricted_path
)
split_restricted_path
)
...
@@ -52,7 +53,6 @@ from caoscrawler.stores import GeneralStore, RecordStore
...
@@ -52,7 +53,6 @@ from caoscrawler.stores import GeneralStore, RecordStore
from
caoscrawler.structure_elements
import
(
DictElement
,
DictListElement
,
from
caoscrawler.structure_elements
import
(
DictElement
,
DictListElement
,
DictTextElement
,
File
)
DictTextElement
,
File
)
from
linkahead.apiutils
import
compare_entities
from
linkahead.apiutils
import
compare_entities
from
caosadvancedtools.models.parser
import
parse_model_from_string
from
linkahead.cached
import
cache_clear
from
linkahead.cached
import
cache_clear
from
linkahead.exceptions
import
EmptyUniqueQueryError
from
linkahead.exceptions
import
EmptyUniqueQueryError
from
pytest
import
raises
from
pytest
import
raises
...
@@ -1144,3 +1144,20 @@ def test_treated_record_lookup():
...
@@ -1144,3 +1144,20 @@ def test_treated_record_lookup():
fi2
=
db
.
File
(
path
=
'
b
'
)
fi2
=
db
.
File
(
path
=
'
b
'
)
trlu
.
add
(
fi2
)
trlu
.
add
(
fi2
)
assert
trlu
.
get_any
(
db
.
File
(
path
=
'
b
'
),
Identifiable
(
name
=
'
c
'
))
is
fi2
assert
trlu
.
get_any
(
db
.
File
(
path
=
'
b
'
),
Identifiable
(
name
=
'
c
'
))
is
fi2
def
test_merge_entity_with_identifying_reference
(
crawler_mocked_identifiable_retrieve
):
# When one python object representing a record is merged into another python object
# representing the same record, the former object can be forgotten and references from it to
# other records must not play a role
crawler
=
crawler_mocked_identifiable_retrieve
crawler
.
identifiableAdapter
.
get_registered_identifiable
=
Mock
(
side_effect
=
lambda
x
:
db
.
Record
().
add_parent
(
'
C
'
).
add_property
(
name
=
'
name
'
)
if
x
.
parents
[
0
].
name
==
"
C
"
else
db
.
Record
().
add_parent
(
'
D
'
).
add_property
(
name
=
'
is_referenced_by
'
,
value
=
"
*
"
)
)
a
=
db
.
Record
(
name
=
'
a
'
).
add_parent
(
"
D
"
)
b
=
db
.
Record
(
name
=
'
b
'
).
add_parent
(
"
C
"
)
c
=
db
.
Record
(
name
=
'
b
'
).
add_parent
(
"
C
"
).
add_property
(
name
=
"
C
"
,
value
=
a
)
flat
=
[
a
,
c
,
b
]
_
,
_
=
crawler
.
split_into_inserts_and_updates
(
flat
)
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