Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
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 Python Integration Tests
Commits
9e055a93
Commit
9e055a93
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add test for ambiguous retrieval
... and mark it as xfail until dealt with on server side
parent
611d48f7
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
tests/test_error_stuff.py
+19
-1
19 additions, 1 deletion
tests/test_error_stuff.py
with
19 additions
and
1 deletion
tests/test_error_stuff.py
+
19
−
1
View file @
9e055a93
...
...
@@ -31,7 +31,8 @@ Created on 19.02.2015.
"""
import
caosdb
as
h
from
caosdb.exceptions
import
(
EntityDoesNotExistError
,
EntityError
,
from
caosdb.exceptions
import
(
AmbiguousEntityError
,
EntityDoesNotExistError
,
EntityError
,
EntityHasNoDatatypeError
,
TransactionError
,
UniqueNamesError
,
UnqualifiedParentsError
,
...
...
@@ -86,6 +87,23 @@ def test_retrieval_exception_raised():
assert
ee
.
entity
.
has_errors
()
@pytest.mark.xfail
(
reason
=
(
"
Error treatment on server-side
"
"
has to be implemented first.
"
))
def
test_ambiguous_retrieval
():
"""
Test if a TransactionError containing an AmbiguousEntityError is
raised correctly if there are two possible candidates.
"""
h
.
RecordType
(
name
=
"
TestType
"
).
insert
()
h
.
Record
(
name
=
"
TestRec
"
).
add_parent
(
name
=
"
TestType
"
).
insert
()
# Insert twice, so unique=False
h
.
Record
(
name
=
"
TestRec
"
).
add_parent
(
name
=
"
TestType
"
).
insert
(
unique
=
False
)
with
pytest
.
raises
(
TransactionError
)
as
te
:
h
.
Record
(
name
=
"
TestRec
"
).
retrieve
()
assert
te
.
value
.
has_error
(
AmbiguousEntityError
)
assert
te
.
value
.
errors
[
0
].
entity
.
name
==
"
TestRec
"
def
test_insertion_no_exception_raised
():
"""
Test whether insertion fails but no error is raised.
"""
p
=
h
.
Property
(
name
=
"
TestNoTypeProperty
"
).
insert
(
...
...
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