Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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-pylib
Commits
d3e9ccc2
Commit
d3e9ccc2
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Fix typos, add xfails
parent
19095398
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_error_handling.py
+9
-6
9 additions, 6 deletions
unittests/test_error_handling.py
with
9 additions
and
6 deletions
unittests/test_error_handling.py
+
9
−
6
View file @
d3e9ccc2
...
...
@@ -33,8 +33,11 @@ from caosdb.exceptions import (AmbiguityException,
AuthorizationException
,
ContainerError
,
EntityDoesNotExistError
,
EntityError
,
EntityHasNoDatatypeError
,
TransactionError
,
UniqueNamesError
)
TransactionError
,
UniqueNamesError
,
UnqualifiedParentsError
,
UnqualifiedPropertiesError
)
import
pytest
# TODO: remove when xfails have been dealt with
from
pytest
import
raises
...
...
@@ -47,7 +50,7 @@ def _add_error_message_to_entity(entity, code, description="Error message"):
description
=
description
)
entity
.
add_message
(
message
)
return
en
e
tity
return
entity
def
test_has_no_datatype_error
():
...
...
@@ -86,7 +89,7 @@ def test_entity_error():
ent
=
_add_error_message_to_entity
(
db
.
Entity
(
name
=
"
TestEnt
"
),
code
)
with
raises
(
TransactionError
)
as
e
:
raise_errors
(
e
)
raise_errors
(
e
nt
)
assert
len
(
e
.
value
.
errors
)
==
1
err
=
e
.
value
.
errors
[
0
]
assert
isinstance
(
err
,
EntityError
)
...
...
@@ -145,7 +148,7 @@ def test_unqualified_parents_error():
assert
isinstance
(
te
.
errors
[
0
].
errors
[
0
],
EntityDoesNotExistError
)
assert
te
.
errors
[
0
].
errors
[
0
].
entity
.
name
==
parent
.
name
@pytest.mark.xfail
def
test_unqualified_properties_error
():
"""
Code 114; properties do not exist or have wrong data types or
values.
...
...
@@ -175,7 +178,7 @@ def test_unqualified_properties_error():
# #################### Multiple errors ####################
@pytest.mark.xfail
def
test_parent_and_properties_errors
():
"""
Record with UnqualifiedParentsError and UnqualifiedPropertiesError,
and corresponding parent and properties with their errors as
...
...
@@ -202,7 +205,7 @@ def test_parent_and_properties_errors():
# TODO: Now there should be two direct children; both have to be
# displayed correctly.
@pytest.mark.xfail
def
test_container_with_faulty_elements
():
"""
Code 12; container with valid and invalid entities. All faulty
entities have to be reflected correctly in the errors list of the
...
...
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