Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pad.face
Commits
178e48d3
Commit
178e48d3
authored
Jan 31, 2019
by
Anjith GEORGE
Browse files
unit tests, WIP
parent
28e747cc
Pipeline
#26469
failed with stage
in 14 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pad/face/database/batl.py
View file @
178e48d3
...
...
@@ -561,10 +561,11 @@ class BatlPadDatabase(PadDatabase):
protocol
=
'nowig'
if
protocol
==
'grandtest'
else
protocol
# Convert group names to low-level group names here.
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
if
not
isinstance
(
groups
,
list
)
and
groups
is
not
None
:
# if a single group is given make it a list
if
not
isinstance
(
groups
,
list
)
and
groups
is
not
None
and
not
isinstance
(
groups
,
str
):
# if a single group is given make it a list
groups
=
list
(
groups
)
if
extra
is
not
None
and
"join_train_dev"
in
extra
:
...
...
bob/pad/face/test/test_databases.py
View file @
178e48d3
...
...
@@ -219,3 +219,63 @@ def test_casiasurf():
raise
SkipTest
(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
%
e
)
# Test the BATL database
def
test_aggregated_db
():
batl_db
=
bob
.
bio
.
base
.
load_resource
(
'batl'
,
'database'
,
preferred_package
=
'bob.pad.face'
,
package_prefix
=
'bob.pad.'
)
try
:
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
]))
==
1679
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
]))
==
1122
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
]))
==
565
assert
len
(
batl_db
.
objects
(
groups
=
'train'
))
==
565
assert
len
(
batl_db
.
objects
(
groups
=
'dev'
))
==
557
assert
len
(
batl_db
.
objects
(
groups
=
'eval'
))
==
557
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
],
protocol
=
'grandtest'
))
==
1679
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
],
protocol
=
'grandtest'
,
purposes
=
'real'
))
==
347
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
],
protocol
=
'grandtest'
,
purposes
=
'attack'
))
==
1332
#tests for join_train_dev protocols
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
],
protocol
=
'grandtest-color-50-join_train_dev'
))
==
1679
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
],
protocol
=
'grandtest-color-50-join_train_dev'
))
==
1679
assert
len
(
batl_db
.
objects
(
groups
=
'eval'
,
protocol
=
'grandtest-color-50-join_train_dev'
))
==
557
# test for LOO_fakehead
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
,
'eval'
],
protocol
=
'grandtest-color-50-LOO_fakehead'
))
==
1149
assert
len
(
batl_db
.
objects
(
groups
=
[
'train'
,
'dev'
],
protocol
=
'grandtest-color-50-LOO_fakehead'
))
==
1017
assert
len
(
batl_db
.
objects
(
groups
=
'eval'
,
protocol
=
'grandtest-color-50-LOO_fakehead'
))
==
132
except
IOError
as
e
:
raise
SkipTest
(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
%
e
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment