Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
27d0aa5d
Verified
Commit
27d0aa5d
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
FIX: More tests, more fixes.
parent
210fbc41
No related branches found
No related tags found
2 merge requests
!100
WIP: Filling XLSX: Seems to be working.
,
!99
FIX: `to_table` failed on lists
Pipeline
#50256
failed
1 year ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/table_converter.py
+9
-3
9 additions, 3 deletions
src/caosadvancedtools/table_converter.py
unittests/test_table_converter.py
+5
-1
5 additions, 1 deletion
unittests/test_table_converter.py
with
14 additions
and
4 deletions
src/caosadvancedtools/table_converter.py
+
9
−
3
View file @
27d0aa5d
...
@@ -25,6 +25,7 @@ import re
...
@@ -25,6 +25,7 @@ import re
import
sys
import
sys
import
caosdb
as
db
import
caosdb
as
db
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
...
@@ -64,9 +65,14 @@ def to_table(container):
...
@@ -64,9 +65,14 @@ def to_table(container):
if
set
([
p
.
name
for
p
in
rec
.
parents
])
!=
rts
:
if
set
([
p
.
name
for
p
in
rec
.
parents
])
!=
rts
:
raise
ValueError
(
"
Parents differ
"
)
raise
ValueError
(
"
Parents differ
"
)
for
p
in
rec
.
get_properties
():
for
prop
in
rec
.
get_properties
():
propname
=
generate_property_name
(
prop
)
df
.
at
[
ii
,
generate_property_name
(
p
)]
=
p
.
value
if
isinstance
(
prop
.
value
,
list
):
if
propname
not
in
df
:
df
[
propname
]
=
pd
.
Series
(
dtype
=
object
)
elif
df
[
propname
].
dtype
!=
np
.
dtypes
.
ObjectDType
:
df
[
propname
]
=
df
[
propname
].
astype
(
object
)
df
.
at
[
ii
,
propname
]
=
prop
.
value
return
df
return
df
...
...
This diff is collapsed.
Click to expand it.
unittests/test_table_converter.py
+
5
−
1
View file @
27d0aa5d
...
@@ -69,10 +69,14 @@ class TableTest(unittest.TestCase):
...
@@ -69,10 +69,14 @@ class TableTest(unittest.TestCase):
r1
=
db
.
Record
()
r1
=
db
.
Record
()
r1
.
add_parent
(
"
no1
"
)
r1
.
add_parent
(
"
no1
"
)
r1
.
add_property
(
"
p1
"
)
r1
.
add_property
(
"
p1
"
)
r1
.
add_property
(
"
p3
"
,
value
=
23
)
r1
.
add_property
(
"
p4
"
,
value
=
[
1
])
r2
=
db
.
Record
()
r2
=
db
.
Record
()
r2
.
add_parent
(
"
no1
"
)
r2
.
add_parent
(
"
no1
"
)
r2
.
add_property
(
"
p1
"
)
r2
.
add_property
(
"
p1
"
)
r2
.
add_property
(
"
p2
"
,
value
=
[
1
,
2
])
r2
.
add_property
(
"
p2
"
,
value
=
[
20
,
21
])
r2
.
add_property
(
"
p3
"
,
value
=
[
30
,
31
])
r2
.
add_property
(
"
p4
"
,
value
=
[
40.0
,
41.0
])
c
=
db
.
Container
()
c
=
db
.
Container
()
c
.
extend
([
r1
,
r2
])
c
.
extend
([
r1
,
r2
])
to_table
(
c
)
to_table
(
c
)
...
...
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