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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
c0c2ae64
Verified
Commit
c0c2ae64
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Actually testing the content.
parent
c3c6dfa9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!100
WIP: Filling XLSX: Seems to be working.
,
!99
FIX: `to_table` failed on lists
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_table_converter.py
+14
-2
14 additions, 2 deletions
unittests/test_table_converter.py
with
14 additions
and
2 deletions
unittests/test_table_converter.py
+
14
−
2
View file @
c0c2ae64
...
@@ -27,6 +27,7 @@ from tempfile import NamedTemporaryFile
...
@@ -27,6 +27,7 @@ from tempfile import NamedTemporaryFile
import
caosdb
as
db
import
caosdb
as
db
import
pandas
as
pd
import
pandas
as
pd
from
caosdb.apiutils
import
compare_entities
from
caosdb.apiutils
import
compare_entities
from
numpy
import
nan
from
caosadvancedtools.table_converter
import
(
from_table
,
from_tsv
,
to_table
,
from
caosadvancedtools.table_converter
import
(
from_table
,
from_tsv
,
to_table
,
to_tsv
)
to_tsv
)
...
@@ -68,7 +69,7 @@ class TableTest(unittest.TestCase):
...
@@ -68,7 +69,7 @@ class TableTest(unittest.TestCase):
def
test_list
(
self
):
def
test_list
(
self
):
r1
=
db
.
Record
()
r1
=
db
.
Record
()
r1
.
add_parent
(
"
no1
"
)
r1
.
add_parent
(
"
no1
"
)
r1
.
add_property
(
"
p1
"
)
r1
.
add_property
(
"
p1
"
,
value
=
1
)
r1
.
add_property
(
"
p3
"
,
value
=
23
)
r1
.
add_property
(
"
p3
"
,
value
=
23
)
r1
.
add_property
(
"
p4
"
,
value
=
[
1
])
r1
.
add_property
(
"
p4
"
,
value
=
[
1
])
r2
=
db
.
Record
()
r2
=
db
.
Record
()
...
@@ -82,7 +83,18 @@ class TableTest(unittest.TestCase):
...
@@ -82,7 +83,18 @@ class TableTest(unittest.TestCase):
r3
.
add_property
(
"
p5
"
,
value
=
[
50
,
51
])
r3
.
add_property
(
"
p5
"
,
value
=
[
50
,
51
])
c
=
db
.
Container
()
c
=
db
.
Container
()
c
.
extend
([
r1
,
r2
,
r3
])
c
.
extend
([
r1
,
r2
,
r3
])
to_table
(
c
)
result
=
to_table
(
c
)
# NaN is hard to compare, so we replace it by -999
# autopep8: off
assert
result
.
replace
(
to_replace
=
nan
,
value
=-
999
).
to_dict
()
==
{
'
p1
'
:
{
0
:
1
,
1
:
-
999
,
2
:
-
999
},
# noqa: E202
'
p3
'
:
{
0
:
23
,
1
:
[
30
,
31
],
2
:
-
999
},
# noqa: E202
'
p4
'
:
{
0
:
[
1
],
1
:
[
40.0
,
41.0
],
2
:
-
999
},
# noqa: E202
'
p2
'
:
{
0
:
-
999
,
1
:
[
20
,
21
],
2
:
-
999
},
# noqa: E202
'
p5
'
:
{
0
:
-
999
,
1
:
-
999
,
2
:
[
50
,
51
]}
}
# autopep8: on
assert
list
(
result
.
dtypes
)
==
[
float
,
object
,
object
,
object
,
object
]
class
FromTsvTest
(
unittest
.
TestCase
):
class
FromTsvTest
(
unittest
.
TestCase
):
...
...
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