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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
429d3d2f
Verified
Commit
429d3d2f
authored
Feb 14, 2020
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
STY: formatting pep8
parent
4cf39b3f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_empty_text_value.py
+30
-13
30 additions, 13 deletions
tests/test_empty_text_value.py
tests/test_query.py
+0
-1
0 additions, 1 deletion
tests/test_query.py
with
30 additions
and
14 deletions
tests/test_empty_text_value.py
+
30
−
13
View file @
429d3d2f
...
@@ -23,6 +23,7 @@ import pytest
...
@@ -23,6 +23,7 @@ import pytest
import
caosdb
as
db
import
caosdb
as
db
def
setup
():
def
setup
():
teardown
()
teardown
()
rt
=
db
.
RecordType
(
"
TestRT
"
)
rt
=
db
.
RecordType
(
"
TestRT
"
)
...
@@ -30,12 +31,14 @@ def setup():
...
@@ -30,12 +31,14 @@ def setup():
p
=
db
.
Property
(
"
TestProp
"
,
datatype
=
db
.
TEXT
)
p
=
db
.
Property
(
"
TestProp
"
,
datatype
=
db
.
TEXT
)
p
.
insert
()
p
.
insert
()
def
teardown
():
def
teardown
():
try
:
try
:
db
.
execute_query
(
"
FIND Test*
"
).
delete
()
db
.
execute_query
(
"
FIND Test*
"
).
delete
()
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
def
test_empty_string
():
def
test_empty_string
():
r1
=
db
.
Record
()
r1
=
db
.
Record
()
r1
.
add_parent
(
"
TestRT
"
)
r1
.
add_parent
(
"
TestRT
"
)
...
@@ -43,21 +46,27 @@ def test_empty_string():
...
@@ -43,21 +46,27 @@ def test_empty_string():
r1
.
insert
()
r1
.
insert
()
# value was stored correctly
# value was stored correctly
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
""
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
""
# query language works for empty string
# query language works for empty string
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
assert
db
.
execute_query
(
'
FIND TestRT with TestProp=
""'
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
""
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
'
FIND TestRT with TestProp=
""'
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
""
r2
=
db
.
Record
()
r2
=
db
.
Record
()
r2
.
add_parent
(
"
TestRT
"
)
r2
.
add_parent
(
"
TestRT
"
)
r2
.
add_property
(
"
TestProp
"
,
value
=
"
not empty
"
)
r2
.
add_property
(
"
TestProp
"
,
value
=
"
not empty
"
)
r2
.
insert
()
r2
.
insert
()
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
'
not empty
'"
,
unique
=
True
).
id
==
r2
.
id
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
'
not empty
'"
,
unique
=
True
).
id
==
r2
.
id
# query language work while other records with non empty values are present
# query language work while other records with non empty values are present
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
assert
len
(
db
.
execute_query
(
"
FIND Record TestRT
"
))
==
2
assert
len
(
db
.
execute_query
(
"
FIND Record TestRT
"
))
==
2
def
test_null_value
():
def
test_null_value
():
r1
=
db
.
Record
()
r1
=
db
.
Record
()
r1
.
add_parent
(
"
TestRT
"
)
r1
.
add_parent
(
"
TestRT
"
)
...
@@ -68,7 +77,8 @@ def test_null_value():
...
@@ -68,7 +77,8 @@ def test_null_value():
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
None
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
None
# query language works with null value
# query language works with null value
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
# add a bit of noise
# add a bit of noise
r2
=
db
.
Record
()
r2
=
db
.
Record
()
...
@@ -76,11 +86,14 @@ def test_null_value():
...
@@ -76,11 +86,14 @@ def test_null_value():
r2
.
add_property
(
"
TestProp
"
,
value
=
"
null
"
)
r2
.
add_property
(
"
TestProp
"
,
value
=
"
null
"
)
r2
.
insert
()
r2
.
insert
()
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
'
null
'"
,
unique
=
True
).
id
==
r2
.
id
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
'
null
'"
,
unique
=
True
).
id
==
r2
.
id
# query language works while other record with non-null values are present
# query language works while other record with non-null values are present
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
assert
len
(
db
.
execute_query
(
"
FIND Record TestRT
"
))
==
2
assert
len
(
db
.
execute_query
(
"
FIND Record TestRT
"
))
==
2
def
test_list_with_empty_string
():
def
test_list_with_empty_string
():
r1
=
db
.
Record
()
r1
=
db
.
Record
()
r1
.
add_parent
(
"
TestRT
"
)
r1
.
add_parent
(
"
TestRT
"
)
...
@@ -91,7 +104,8 @@ def test_list_with_empty_string():
...
@@ -91,7 +104,8 @@ def test_list_with_empty_string():
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
""
]
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
""
]
# query language works
# query language works
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
r2
=
db
.
Record
()
r2
=
db
.
Record
()
r2
.
add_parent
(
"
TestRT
"
)
r2
.
add_parent
(
"
TestRT
"
)
...
@@ -99,8 +113,11 @@ def test_list_with_empty_string():
...
@@ -99,8 +113,11 @@ def test_list_with_empty_string():
r2
.
insert
()
r2
.
insert
()
assert
db
.
execute_query
(
"
FIND Record TestRT with TestProp=
'
leer
'"
,
assert
db
.
execute_query
(
"
FIND Record TestRT with TestProp=
'
leer
'"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
"
leer
"
]
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
"
leer
"
]
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
'
leer
'"
,
unique
=
True
).
id
==
r2
.
id
assert
db
.
execute_query
(
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
"
FIND TestRT with TestProp=
'
leer
'"
,
unique
=
True
).
id
==
r2
.
id
assert
db
.
execute_query
(
"
FIND TestRT with TestProp=
''"
,
unique
=
True
).
id
==
r1
.
id
def
test_null_list
():
def
test_null_list
():
r1
=
db
.
Record
()
r1
=
db
.
Record
()
...
@@ -111,7 +128,8 @@ def test_null_list():
...
@@ -111,7 +128,8 @@ def test_null_list():
# null list was stored correctly
# null list was stored correctly
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
assert
db
.
execute_query
(
"
FIND Record TestRT
"
,
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
None
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
None
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
assert
db
.
execute_query
(
"
FIND TestRT WHERE TestProp IS NULL
"
,
unique
=
True
).
id
==
r1
.
id
@pytest.mark.skip
(
reason
=
"""
this is the confirmation for
@pytest.mark.skip
(
reason
=
"""
this is the confirmation for
...
@@ -145,4 +163,3 @@ def test_list_with_null_value():
...
@@ -145,4 +163,3 @@ def test_list_with_null_value():
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
None
]
unique
=
True
).
get_property
(
"
TestProp
"
).
value
==
[
None
]
# assert db.execute_query("FIND TestRT WHERE TestProp IS NULL", unique=True).id == r.id
# assert db.execute_query("FIND TestRT WHERE TestProp IS NULL", unique=True).id == r.id
r
.
delete
()
r
.
delete
()
This diff is collapsed.
Click to expand it.
tests/test_query.py
+
0
−
1
View file @
429d3d2f
...
@@ -860,7 +860,6 @@ def test_stored_at_wildcards():
...
@@ -860,7 +860,6 @@ def test_stored_at_wildcards():
assert
c
.
get_entity_by_id
(
file8
.
id
)
is
not
None
assert
c
.
get_entity_by_id
(
file8
.
id
)
is
not
None
@with_setup
(
setup
,
teardown
)
@with_setup
(
setup
,
teardown
)
def
test_int
():
def
test_int
():
pint
=
h
.
Property
(
name
=
"
TestIntegerProperty
"
,
datatype
=
h
.
INTEGER
).
insert
()
pint
=
h
.
Property
(
name
=
"
TestIntegerProperty
"
,
datatype
=
h
.
INTEGER
).
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