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
6d733c76
Commit
6d733c76
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
API: Rename enum_converter to string_in_list
parent
4e3145e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Release 0.3
Pipeline
#14714
failed
3 years ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-1
1 addition, 1 deletion
CHANGELOG.md
src/caosadvancedtools/table_importer.py
+1
-1
1 addition, 1 deletion
src/caosadvancedtools/table_importer.py
unittests/test_table_importer.py
+9
-8
9 additions, 8 deletions
unittests/test_table_importer.py
with
11 additions
and
10 deletions
CHANGELOG.md
+
1
−
1
View file @
6d733c76
...
...
@@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
Proof-of-concept integration with Bloxberg.
-
Introduce a cfood that can create a Record structure based on the contents of a hdf5 file
h5py is now an optional dependency
-
enum_converter
for table imports
-
string-in-list check
for table imports
### Changed ###
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/table_importer.py
+
1
−
1
View file @
6d733c76
...
...
@@ -145,7 +145,7 @@ def win_path_converter(val):
return
path
.
as_posix
()
def
enum_converter
(
val
,
options
,
ignore_case
=
True
):
def
string_in_list
(
val
,
options
,
ignore_case
=
True
):
"""
Return the given value if it is contained in options, raise an
error otherwise.
...
...
This diff is collapsed.
Click to expand it.
unittests/test_table_importer.py
+
9
−
8
View file @
6d733c76
...
...
@@ -33,7 +33,7 @@ from caosadvancedtools.table_importer import (XLSImporter, assure_name_format,
incomplete_date_converter
,
win_path_converter
,
win_path_list_converter
,
enum_converter
,
string_in_list
,
yes_no_converter
)
...
...
@@ -50,14 +50,15 @@ class ConverterTest(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
yes_no_converter
,
"
True
"
)
self
.
assertRaises
(
ValueError
,
yes_no_converter
,
"
true
"
)
def
test_
enum
(
self
):
self
.
assertEqual
(
"
false
"
,
enum_converter
(
"
false
"
,
def
test_
string_in_list
(
self
):
self
.
assertEqual
(
"
false
"
,
string_in_list
(
"
false
"
,
[
"
FALSE
"
,
"
TRUE
"
]))
self
.
assertEqual
(
"
FALSE
"
,
enum_converter
(
"
FALSE
"
,
self
.
assertEqual
(
"
FALSE
"
,
string_in_list
(
"
FALSE
"
,
[
"
FALSE
"
,
"
TRUE
"
],
False
))
self
.
assertRaises
(
ValueError
,
enum_converter
,
"
FALSE
"
,
[])
self
.
assertRaises
(
ValueError
,
enum_converter
,
"
FALSE
"
,
[
"
fals
"
])
self
.
assertRaises
(
ValueError
,
enum_converter
,
"
FALSE
"
,
[
"
false
"
],
False
)
self
.
assertRaises
(
ValueError
,
string_in_list
,
"
FALSE
"
,
[])
self
.
assertRaises
(
ValueError
,
string_in_list
,
"
FALSE
"
,
[
"
fals
"
])
self
.
assertRaises
(
ValueError
,
string_in_list
,
"
FALSE
"
,
[
"
false
"
],
False
)
def
test_assure_name_format
(
self
):
self
.
assertEqual
(
assure_name_format
(
"
Müstermann, Max
"
),
...
...
@@ -72,7 +73,7 @@ class ConverterTest(unittest.TestCase):
[
"
/this/computer
"
])
self
.
assertEqual
(
win_path_list_converter
(
r
"
\this\computer,\this\computer
"
),
[
"
/this/computer
"
,
"
/this/computer
"
])
[
"
/this/computer
"
,
"
/this/computer
"
])
def
test_datetime
(
self
):
test_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
date.xlsx
"
)
...
...
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