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
8ccc7cd7
Commit
8ccc7cd7
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
DOC: Added more in-code documentation.
parent
76b7a5f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!9
Tests for obligatory properties
Pipeline
#8944
passed
3 years ago
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_importance.py
+9
-4
9 additions, 4 deletions
tests/test_importance.py
with
9 additions
and
4 deletions
tests/test_importance.py
+
9
−
4
View file @
8ccc7cd7
...
...
@@ -40,7 +40,7 @@ def test_obl_missing_error():
rt1
.
add_property
(
name
=
"
TestOblProperty
"
,
importance
=
db
.
OBLIGATORY
)
rt1
.
insert
()
# normal behaviour
# normal behaviour
, should be identical to "error" level
rt2
=
db
.
RecordType
(
name
=
"
TestRecordType2
"
)
rt2
.
add_parent
(
"
TestRecordType1
"
,
inheritance
=
db
.
NONE
)
rt2
.
add_property
(
"
TestDummyProperty
"
)
...
...
@@ -64,7 +64,8 @@ def test_obl_missing_error():
rt2
.
set_flag
(
"
force-missing-obligatory
"
,
"
warn
"
)
with
raises
(
db
.
TransactionError
)
as
exc
:
rt2
.
insert
(
strict
=
True
)
assert
exc
.
value
.
errors
[
0
].
msg
==
"
A warning occured while processing an entity with the strict flag.
"
assert
exc
.
value
.
errors
[
0
].
msg
==
(
"
A warning occured while processing an entity with the strict flag.
"
)
assert
"
An obligatory property is missing.
"
in
[
w
.
description
for
w
in
rt2
.
get_warnings
()]
...
...
@@ -75,8 +76,8 @@ def test_obl_missing_error():
rt2
.
set_flag
(
"
force-missing-obligatory
"
,
"
warn
"
)
rt2
.
insert
()
assert
len
(
rt2
.
get_errors
())
==
0
assert
rt2
.
get_warnings
(
)[
0
].
description
==
"
An obligatory property is missing.
"
assert
(
rt2
.
get_warnings
(
)[
0
].
description
==
"
An obligatory property is missing.
"
)
# insert silently
rt3
=
db
.
RecordType
(
name
=
"
TestRecordType3
"
)
...
...
@@ -105,6 +106,8 @@ def test_obl_missing_parent_in_same_container():
def
test_obl_missing_parent_in_same_container_override
():
"""
`force-missing-obligatory` flags of entities override flags of containing containers.
"""
p
=
db
.
Property
(
name
=
"
TestOblProperty
"
,
datatype
=
db
.
TEXT
).
insert
()
rt1
=
db
.
RecordType
(
name
=
"
TestRecordType1
"
)
...
...
@@ -122,6 +125,8 @@ def test_obl_missing_parent_in_same_container_override():
def
test_sub_property_of_obl
():
"""
If p1 <|- p2, then p2 should work for an obligatory p1.
"""
p1
=
db
.
Property
(
name
=
"
TestOblProperty1
"
,
datatype
=
db
.
TEXT
).
insert
()
p2
=
db
.
Property
(
name
=
"
TestOblProperty2
"
,
datatype
=
db
.
TEXT
)
p2
.
add_parent
(
"
TestOblProperty1
"
)
...
...
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