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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
5935c5f9
Commit
5935c5f9
authored
Oct 5, 2022
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
STY: autopep'd and cleaned up imports
parent
9a58ec28
No related branches found
No related tags found
2 merge requests
!53
Release 0.1
,
!45
Scalars in cfood definitions
Pipeline
#28987
passed
Oct 5, 2022
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/converters.py
+1
-1
1 addition, 1 deletion
src/caoscrawler/converters.py
unittests/test_scalars_cfood.py
+6
-35
6 additions, 35 deletions
unittests/test_scalars_cfood.py
with
7 additions
and
36 deletions
src/caoscrawler/converters.py
+
1
−
1
View file @
5935c5f9
This diff is collapsed.
Click to expand it.
unittests/test_scalars_cfood.py
+
6
−
35
View file @
5935c5f9
...
@@ -3,44 +3,15 @@
...
@@ -3,44 +3,15 @@
# https://gitlab.com/caosdb/caosdb-crawler/-/issues/9
# https://gitlab.com/caosdb/caosdb-crawler/-/issues/9
# A. Schlemmer, 06/2021
# A. Schlemmer, 06/2021
from
caoscrawler.crawl
import
Crawler
,
SecurityMode
from
caoscrawler.structure_elements
import
File
,
DictTextElement
,
DictListElement
from
caoscrawler.identifiable_adapters
import
IdentifiableAdapter
,
LocalStorageIdentifiableAdapter
from
simulated_server_data
import
full_data
from
functools
import
partial
from
copy
import
deepcopy
from
unittest.mock
import
patch
import
caosdb.common.models
as
dbmodels
from
unittest.mock
import
MagicMock
,
Mock
from
os.path
import
join
,
dirname
,
basename
import
yaml
import
caosdb
as
db
from
caosdb.apiutils
import
compare_entities
import
pytest
import
pytest
from
pytest
import
raises
# The main function that is affected by this issue:
# The main function that is affected by this issue:
from
caoscrawler.converters
import
handle_value
from
caoscrawler.converters
import
handle_value
from
caoscrawler.crawl
import
Crawler
# We need the store for the above function
# We need the store for the above function
from
caoscrawler.stores
import
GeneralStore
from
caoscrawler.stores
import
GeneralStore
from
test_tool
import
dircheckstr
,
rfp
def
rfp
(
*
pathcomponents
):
"""
Return full path.
Shorthand convenience function.
"""
return
join
(
dirname
(
__file__
),
*
pathcomponents
)
def
dircheckstr
(
*
pathcomponents
):
"""
Return the debug tree identifier for a given path.
"""
return
(
"
caoscrawler.structure_elements.Directory:
"
+
basename
(
join
(
*
pathcomponents
))
+
"
,
"
+
rfp
(
"
test_directories
"
,
"
examples_article
"
,
*
pathcomponents
))
@pytest.fixture
@pytest.fixture
...
@@ -58,7 +29,7 @@ def test_handle_value():
...
@@ -58,7 +29,7 @@ def test_handle_value():
# This one should work:
# This one should work:
assert
handle_value
(
"
bla
"
,
store
)
==
(
"
bla
"
,
"
single
"
)
assert
handle_value
(
"
bla
"
,
store
)
==
(
"
bla
"
,
"
single
"
)
# These
ones will currently
fail:
# These fail
ed
:
assert
handle_value
(
4
,
store
)
==
(
4
,
"
single
"
)
assert
handle_value
(
4
,
store
)
==
(
4
,
"
single
"
)
assert
handle_value
(
4.2
,
store
)
==
(
4.2
,
"
single
"
)
assert
handle_value
(
4.2
,
store
)
==
(
4.2
,
"
single
"
)
assert
handle_value
(
True
,
store
)
==
(
True
,
"
single
"
)
assert
handle_value
(
True
,
store
)
==
(
True
,
"
single
"
)
...
@@ -66,6 +37,7 @@ def test_handle_value():
...
@@ -66,6 +37,7 @@ def test_handle_value():
# List test:
# List test:
assert
handle_value
([
4
,
3
,
2
],
store
)
==
([
4
,
3
,
2
],
"
single
"
)
assert
handle_value
([
4
,
3
,
2
],
store
)
==
([
4
,
3
,
2
],
"
single
"
)
def
test_record_structure_generation
(
crawler
):
def
test_record_structure_generation
(
crawler
):
subd
=
crawler
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
)]
subd
=
crawler
.
debug_tree
[
dircheckstr
(
"
DataAnalysis
"
)]
assert
len
(
subd
)
==
2
assert
len
(
subd
)
==
2
...
@@ -81,6 +53,5 @@ def test_record_structure_generation(crawler):
...
@@ -81,6 +53,5 @@ def test_record_structure_generation(crawler):
# record store on Data Analysis node of debug tree
# record store on Data Analysis node of debug tree
assert
len
(
subd
[
1
])
==
1
assert
len
(
subd
[
1
])
==
1
prop2
=
subd
[
0
][
"
RecordThatGetsParentsLater
"
].
get_property
(
"
someId
"
)
prop2
=
subd
[
1
][
"
RecordThatGetsParentsLater
"
].
get_property
(
"
someId
"
)
assert
prop
==
prop2
assert
prop
==
prop2
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