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
6cdd4f20
Commit
6cdd4f20
authored
4 months ago
by
I. Nüske
Browse files
Options
Downloads
Patches
Plain Diff
TST: Reenable failing test
parent
8a619c79
No related branches found
No related tags found
2 merge requests
!138
Release 0.14.0
,
!129
Enable validation in table_json_conversion.convert.to_dict for use in XLSX-converter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/table_json_conversion/convert.py
+1
-7
1 addition, 7 deletions
src/caosadvancedtools/table_json_conversion/convert.py
unittests/table_json_conversion/test_read_xlsx.py
+1
-3
1 addition, 3 deletions
unittests/table_json_conversion/test_read_xlsx.py
with
2 additions
and
10 deletions
src/caosadvancedtools/table_json_conversion/convert.py
+
1
−
7
View file @
6cdd4f20
...
@@ -707,8 +707,6 @@ def _set_in_nested(mydict: dict, path: list, value: Any, prefix: list = [], skip
...
@@ -707,8 +707,6 @@ def _set_in_nested(mydict: dict, path: list, value: Any, prefix: list = [], skip
return
mydict
return
mydict
# ToDo: Fix https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138
# and remove pylint disable
def
to_dict
(
xlsx
:
Union
[
str
,
BinaryIO
],
schema
:
Union
[
dict
,
str
,
TextIO
],
def
to_dict
(
xlsx
:
Union
[
str
,
BinaryIO
],
schema
:
Union
[
dict
,
str
,
TextIO
],
validate
:
Optional
[
bool
]
=
None
,
strict
:
bool
=
False
)
->
dict
:
validate
:
Optional
[
bool
]
=
None
,
strict
:
bool
=
False
)
->
dict
:
"""
Convert the xlsx contents to a dict, it must follow a schema.
"""
Convert the xlsx contents to a dict, it must follow a schema.
...
@@ -733,9 +731,5 @@ def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO],
...
@@ -733,9 +731,5 @@ def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO],
out: dict
out: dict
A dict representing the JSON with the extracted data.
A dict representing the JSON with the extracted data.
"""
"""
if
validate
:
raise
NotImplementedError
(
"
For input validation implement
"
"
https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138
"
)
converter
=
XLSXConverter
(
xlsx
,
schema
,
strict
=
strict
)
converter
=
XLSXConverter
(
xlsx
,
schema
,
strict
=
strict
)
return
converter
.
to_dict
()
return
converter
.
to_dict
(
validate
=
validate
)
This diff is collapsed.
Click to expand it.
unittests/table_json_conversion/test_read_xlsx.py
+
1
−
3
View file @
6cdd4f20
...
@@ -53,9 +53,7 @@ Returns
...
@@ -53,9 +53,7 @@ Returns
json: dict
json: dict
The result of the conversion.
The result of the conversion.
"""
"""
# FIXME Set default "validate" back to True, after implementation of
result
=
convert
.
to_dict
(
xlsx
=
xlsx_file
,
schema
=
schema_file
,
validate
=
True
)
# https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138
result
=
convert
.
to_dict
(
xlsx
=
xlsx_file
,
schema
=
schema_file
,
validate
=
validate
)
if
known_good_file
:
if
known_good_file
:
with
open
(
known_good_file
,
encoding
=
"
utf-8
"
)
as
myfile
:
with
open
(
known_good_file
,
encoding
=
"
utf-8
"
)
as
myfile
:
expected
=
json
.
load
(
myfile
)
expected
=
json
.
load
(
myfile
)
...
...
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