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
c24d57bb
Commit
c24d57bb
authored
4 years ago
by
Alexander Kreft
Browse files
Options
Downloads
Patches
Plain Diff
import caosdb as db
parent
47991123
No related branches found
No related tags found
1 merge request
!14
F delete container
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_container.py
+23
-23
23 additions, 23 deletions
unittests/test_container.py
with
23 additions
and
23 deletions
unittests/test_container.py
+
23
−
23
View file @
c24d57bb
...
@@ -25,28 +25,28 @@
...
@@ -25,28 +25,28 @@
"""
Tests for the Container class.
"""
"""
Tests for the Container class.
"""
from
__future__
import
absolute_import
from
__future__
import
absolute_import
import
caosdb
as
c
import
caosdb
as
db
def
test_get_property_values
():
def
test_get_property_values
():
rt_house
=
c
.
RecordType
(
"
House
"
)
rt_house
=
db
.
RecordType
(
"
House
"
)
rt_window
=
c
.
RecordType
(
"
Window
"
)
rt_window
=
db
.
RecordType
(
"
Window
"
)
rt_owner
=
c
.
RecordType
(
"
Owner
"
)
rt_owner
=
db
.
RecordType
(
"
Owner
"
)
p_height
=
c
.
Property
(
"
Height
"
,
datatype
=
c
.
DOUBLE
)
p_height
=
db
.
Property
(
"
Height
"
,
datatype
=
db
.
DOUBLE
)
window
=
c
.
Record
().
add_parent
(
rt_window
)
window
=
db
.
Record
().
add_parent
(
rt_window
)
window
.
id
=
1001
window
.
id
=
1001
window
.
add_property
(
p_height
,
20.5
,
unit
=
"
m
"
)
window
.
add_property
(
p_height
,
20.5
,
unit
=
"
m
"
)
owner
=
c
.
Record
(
"
The Queen
"
).
add_parent
(
rt_owner
)
owner
=
db
.
Record
(
"
The Queen
"
).
add_parent
(
rt_owner
)
house
=
c
.
Record
(
"
Buckingham Palace
"
)
house
=
db
.
Record
(
"
Buckingham Palace
"
)
house
.
add_parent
(
rt_house
)
house
.
add_parent
(
rt_house
)
house
.
add_property
(
rt_owner
,
owner
)
house
.
add_property
(
rt_owner
,
owner
)
house
.
add_property
(
rt_window
,
window
)
house
.
add_property
(
rt_window
,
window
)
house
.
add_property
(
p_height
,
40.2
,
unit
=
"
ft
"
)
house
.
add_property
(
p_height
,
40.2
,
unit
=
"
ft
"
)
container
=
c
.
Container
()
container
=
db
.
Container
()
container
.
extend
([
container
.
extend
([
house
,
house
,
owner
owner
...
@@ -80,40 +80,40 @@ def test_get_property_values():
...
@@ -80,40 +80,40 @@ def test_get_property_values():
def
test_container_dependencies_for_deletion
():
def
test_container_dependencies_for_deletion
():
rt
=
c
.
RecordType
(
"
Just a RecordType
"
)
rt
=
db
.
RecordType
(
"
Just a RecordType
"
)
rt
.
id
=
1001
rt
.
id
=
1001
rt_dep
=
c
.
RecordType
(
"
Just another RecordType
"
)
rt_dep
=
db
.
RecordType
(
"
Just another RecordType
"
)
rt_dep
.
id
=
1002
rt_dep
.
id
=
1002
rt_record_without_dependencies
=
c
.
RecordType
(
rt_record_without_dependencies
=
db
.
RecordType
(
"
Records without dependencies
"
)
"
Records without dependencies
"
)
rt_record_without_dependencies
.
id
=
1003
rt_record_without_dependencies
.
id
=
1003
rt_record_with_dependencies
=
c
.
RecordType
(
"
Records with dependencies
"
)
rt_record_with_dependencies
=
db
.
RecordType
(
"
Records with dependencies
"
)
rt_record_with_dependencies
.
id
=
1004
rt_record_with_dependencies
.
id
=
1004
rt_record_with_parent
=
c
.
RecordType
(
"
Records with parent
"
)
rt_record_with_parent
=
db
.
RecordType
(
"
Records with parent
"
)
rt_record_with_parent
.
id
=
1005
rt_record_with_parent
.
id
=
1005
property_which_is_not_a_record
=
c
.
Property
(
property_which_is_not_a_record
=
db
.
Property
(
"
Normal Property
"
,
datatype
=
c
.
DOUBLE
,
value
=
1006
)
"
Normal Property
"
,
datatype
=
db
.
DOUBLE
,
value
=
1006
)
property_which_is_not_a_record
.
id
=
1006
property_which_is_not_a_record
.
id
=
1006
record_without_dependencies
=
c
.
Record
().
add_parent
(
rt_record_without_dependencies
)
record_without_dependencies
=
db
.
Record
().
add_parent
(
rt_record_without_dependencies
)
record_without_dependencies
.
id
=
2003
record_without_dependencies
.
id
=
2003
record_dep
=
c
.
Record
().
add_parent
(
rt_dep
)
record_dep
=
db
.
Record
().
add_parent
(
rt_dep
)
record_dep
.
id
=
2002
record_dep
.
id
=
2002
record_with_dependencies
=
c
.
Record
().
add_parent
(
rt_record_with_dependencies
)
record_with_dependencies
=
db
.
Record
().
add_parent
(
rt_record_with_dependencies
)
record_with_dependencies
.
id
=
2004
record_with_dependencies
.
id
=
2004
record_with_dependencies
.
add_property
(
rt_dep
,
record_dep
)
record_with_dependencies
.
add_property
(
rt_dep
,
record_dep
)
record_with_parent
=
c
.
Record
().
add_parent
(
rt_record_with_parent
)
record_with_parent
=
db
.
Record
().
add_parent
(
rt_record_with_parent
)
record_with_parent
.
id
=
2005
record_with_parent
.
id
=
2005
record_with_property_which_is_not_a_record
=
c
.
Record
(
record_with_property_which_is_not_a_record
=
db
.
Record
(
).
add_parent
(
rt_record_without_dependencies
)
).
add_parent
(
rt_record_without_dependencies
)
record_with_property_which_is_not_a_record
.
id
=
2006
record_with_property_which_is_not_a_record
.
id
=
2006
record_with_property_which_is_not_a_record
.
add_property
(
record_with_property_which_is_not_a_record
.
add_property
(
property_which_is_not_a_record
)
property_which_is_not_a_record
)
container
=
c
.
Container
()
container
=
db
.
Container
()
container
.
extend
([
container
.
extend
([
rt
,
rt
,
rt_record_with_parent
,
# 1005, dependency
rt_record_with_parent
,
# 1005, dependency
...
@@ -123,4 +123,4 @@ def test_container_dependencies_for_deletion():
...
@@ -123,4 +123,4 @@ def test_container_dependencies_for_deletion():
record_with_parent
,
record_with_parent
,
record_with_property_which_is_not_a_record
record_with_property_which_is_not_a_record
])
])
assert
c
.
Container
().
_test_dependencies_in_container
(
container
)
==
{
2002
,
1005
}
assert
db
.
Container
().
_test_dependencies_in_container
(
container
)
==
{
2002
,
1005
}
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