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
c14fcef2
Verified
Commit
c14fcef2
authored
9 months ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
STY: Whitespaces and test.
parent
45384af9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!112
Release 0.12.0
,
!111
F better csv value error
Pipeline
#53503
passed
9 months ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/table_importer.py
+1
-1
1 addition, 1 deletion
src/caosadvancedtools/table_importer.py
unittests/test_table_importer.py
+4
-3
4 additions, 3 deletions
unittests/test_table_importer.py
with
5 additions
and
4 deletions
src/caosadvancedtools/table_importer.py
+
1
−
1
View file @
c14fcef2
...
@@ -574,7 +574,7 @@ class CSVImporter(TableImporter):
...
@@ -574,7 +574,7 @@ class CSVImporter(TableImporter):
for
ii
,
error_list
in
error_dict
.
items
():
for
ii
,
error_list
in
error_dict
.
items
():
msg
+=
f
"
* row
{
ii
}
:
\n
"
msg
+=
f
"
* row
{
ii
}
:
\n
"
for
err
in
error_list
:
for
err
in
error_list
:
msg
+=
f
"
\t
* column
\"
{
err
[
0
]
}
\"
: Expected
\"
{
err
[
1
]
}
\"
but found
\"
{
err
[
2
]
}
\"
.
\n
"
msg
+=
f
"
* column
\"
{
err
[
0
]
}
\"
: Expected
\"
{
err
[
1
]
}
\"
but found
\"
{
err
[
2
]
}
\"
.
\n
"
msg
+=
'
\n
'
msg
+=
'
\n
'
raise
DataInconsistencyError
(
msg
)
raise
DataInconsistencyError
(
msg
)
...
...
This diff is collapsed.
Click to expand it.
unittests/test_table_importer.py
+
4
−
3
View file @
c14fcef2
...
@@ -408,6 +408,7 @@ class CSVImporterTest(TableImporterTest):
...
@@ -408,6 +408,7 @@ class CSVImporterTest(TableImporterTest):
with
pytest
.
raises
(
DataInconsistencyError
)
as
die
:
with
pytest
.
raises
(
DataInconsistencyError
)
as
die
:
df
=
importer
.
read_file
(
tmpfile
.
name
)
df
=
importer
.
read_file
(
tmpfile
.
name
)
msg
=
str
(
die
.
value
)
msg
=
str
(
die
.
value
)
print
(
"
\n
"
+
msg
)
assert
"
Elements with wrong datatypes encountered:
\n
"
in
msg
assert
"
Elements with wrong datatypes encountered:
\n
"
in
msg
# Errors in rows 1 and 3, no errors in 2 and 4
# Errors in rows 1 and 3, no errors in 2 and 4
assert
"
* row 1:
\n
"
in
msg
assert
"
* row 1:
\n
"
in
msg
...
@@ -418,9 +419,9 @@ class CSVImporterTest(TableImporterTest):
...
@@ -418,9 +419,9 @@ class CSVImporterTest(TableImporterTest):
# exactly 2 errors in row 1, exactly 1 in row 3
# exactly 2 errors in row 1, exactly 1 in row 3
assert
len
(
row_1_msgs
.
strip
().
split
(
'
\n
'
))
==
2
assert
len
(
row_1_msgs
.
strip
().
split
(
'
\n
'
))
==
2
assert
len
(
row_3_msgs
.
strip
().
split
(
'
\n
'
))
==
1
assert
len
(
row_3_msgs
.
strip
().
split
(
'
\n
'
))
==
1
assert
"
\t
* column
\"
int
\"
"
in
row_1_msgs
assert
"
* column
\"
int
\"
"
in
row_1_msgs
assert
"
\t
* column
\"
float
\"
"
in
row_1_msgs
assert
"
* column
\"
float
\"
"
in
row_1_msgs
assert
"
\t
* column
\"
float
\"
"
in
row_3_msgs
assert
"
* column
\"
float
\"
"
in
row_3_msgs
class
TSVImporterTest
(
TableImporterTest
):
class
TSVImporterTest
(
TableImporterTest
):
...
...
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