Skip to content
Snippets Groups Projects
Commit 27797406 authored by Philip ABBET's avatar Philip ABBET
Browse files

[unittests] Move a lot of the unit tests to beat.backend.python

parent 235109d3
No related branches found
No related tags found
1 merge request!32Merge development branch 1.6.x
Showing
with 4 additions and 747 deletions
......@@ -26,6 +26,7 @@
###############################################################################
from beat.backend.python.data import mixDataIndices
from beat.backend.python.data import getAllFilenames
from beat.backend.python.data import CachedFileLoader
from beat.backend.python.data import DataSource
......
......@@ -31,3 +31,4 @@ from beat.backend.python.inputs import Input
from beat.backend.python.inputs import InputGroup
from beat.backend.python.inputs import RemoteInput
from beat.backend.python.inputs import RemoteException
from beat.backend.python.inputs import DataLoaderGroup
......@@ -3,10 +3,10 @@
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# This file is part of the beat.backend.python module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
......
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"images": {
"type": "user/2d_array_of_integers/1"
},
"labels": {
"type": "user/floats/1"
}
},
"outputs": {
"features": {
"type": "user/1d_array_of_integers/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class InvalidAlgorithmClassName:
def process(self, inputs, outputs):
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"in_data": {
"type": "user/single_integer/1"
}
},
"outputs": {
"out_data": {
"type": "user/single_integer/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def process(self, inputs, outputs):
outputs['out_data'].write(inputs['in_data'].data)
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"in_data": {
"type": "user/single_integer/1"
}
},
"outputs": {
"out_data": {
"type": "user/single_integer/1"
}
}
}
]
}
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"images": {
"type": "user/2d_array_of_integers/1"
},
"labels": {
"type": "user/floats/1"
}
},
"outputs": {
"features": {
"type": "user/1d_array_of_integers/1"
}
}
}
],
"parameters": {
"int8_value": {
"default": "5",
"type": "int8",
"description": "Some comment"
},
"int8_range": {
"default": "6",
"range": [
0,
"10"
],
"type": "int8",
"description": "Another comment"
},
"int8_choices": {
"default": "4",
"type": "int8",
"choice": [
"2",
"4",
"6",
"8",
"10"
]
},
"int16_value": {
"default": "500",
"type": "int16"
},
"int16_range": {
"default": "300",
"type": "int16",
"range": [
"0",
"1000"
]
},
"int16_choices": {
"default": "400",
"type": "int16",
"choice": [
"200",
"400",
"600",
"800",
"1000"
]
},
"int16_choices2": {
"default": "400",
"type": "int16",
"choice": [
"600",
"400"
]
},
"int32_value": {
"default": "500000",
"type": "int32"
},
"int32_range": {
"default": "500000",
"type": "int32",
"range": [
"0",
"1000000"
]
},
"int32_choices": {
"default": "400000",
"type": "int32",
"choice": [
"200000",
"400000",
"600000",
"800000",
"1000000"
]
},
"int64_value": {
"default": "5000000000",
"type": "int64"
},
"int64_range": {
"default": "5000000000",
"type": "int64",
"range": [
"0",
"10000000000"
]
},
"int64_choices": {
"default": "4000000000",
"type": "int64",
"choice": [
"2000000000",
"4000000000",
"6000000000",
"8000000000",
"10000000000"
]
},
"uint8_value": {
"default": "5",
"type": "uint8"
},
"uint8_range": {
"default": "6",
"type": "uint8",
"range": [
"0",
"10"
]
},
"uint8_choices": {
"default": "4",
"type": "uint8",
"choice": [
"2",
"4",
"6",
"8",
"10"
]
},
"uint16_value": {
"default": "500",
"type": "uint16"
},
"uint16_range": {
"default": "500",
"type": "uint16",
"range": [
"0",
"1000"
]
},
"uint16_choices": {
"default": "400",
"type": "uint16",
"choice": [
"200",
"400",
"600",
"800",
"1000"
]
},
"uint32_value": {
"default": "500000",
"type": "uint32"
},
"uint32_range": {
"default": "500000",
"type": "uint32",
"range": [
"0",
"1000000"
]
},
"uint32_choices": {
"default": "400000",
"type": "uint32",
"choice": [
"200000",
"400000",
"600000",
"800000",
"1000000"
]
},
"uint64_value": {
"default": "5000000000",
"type": "uint64"
},
"uint64_range": {
"default": "5000000000",
"type": "uint64",
"range": [
"0",
"10000000000"
]
},
"uint64_choices": {
"default": "4000000000",
"type": "uint64",
"choice": [
"2000000000",
"4000000000",
"6000000000",
"8000000000",
"10000000000"
]
},
"float32_value": {
"default": "0.0",
"type": "float32"
},
"float32_range": {
"default": "0.0",
"type": "float32",
"range": [
"-10.0",
"10.0"
]
},
"float32_choices": {
"default": "0.0",
"type": "float32",
"choice": [
"-10.0",
"-5.0",
"0.0",
"5.0",
"10.0"
]
},
"float64_value": {
"default": "0.0",
"type": "float64"
},
"float64_range": {
"default": "0.0",
"type": "float64",
"range": [
"-100.0",
"100.0"
]
},
"float64_choices": {
"default": "0.0",
"type": "float64",
"choice": [
-10.0,
-5.0,
0.0,
5.0,
10.0
]
},
"bool_value": {
"default": true,
"type": "bool"
},
"string_value": {
"default": "choice1",
"type": "string",
"choice": [
"choice1",
"choice2",
"choice3"
]
}
}
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def setup(self, parameters):
self.int8_value = parameters['int8_value']
self.int8_range = parameters['int8_range']
self.int8_choices = parameters['int8_choices']
self.int16_value = parameters['int16_value']
self.int16_range = parameters['int16_range']
self.int16_choices = parameters['int16_choices']
self.int32_value = parameters['int32_value']
self.int32_range = parameters['int32_range']
self.int32_choices = parameters['int32_choices']
self.int64_value = parameters['int64_value']
self.int64_range = parameters['int64_range']
self.int64_choices = parameters['int64_choices']
self.uint8_value = parameters['uint8_value']
self.uint8_range = parameters['uint8_range']
self.uint8_choices = parameters['uint8_choices']
self.uint16_value = parameters['uint16_value']
self.uint16_range = parameters['uint16_range']
self.uint16_choices = parameters['uint16_choices']
self.uint32_value = parameters['uint32_value']
self.uint32_range = parameters['uint32_range']
self.uint32_choices = parameters['uint32_choices']
self.uint64_value = parameters['uint64_value']
self.uint64_range = parameters['uint64_range']
self.uint64_choices = parameters['uint64_choices']
self.float32_value = parameters['float32_value']
self.float32_range = parameters['float32_range']
self.float32_choices = parameters['float32_choices']
self.float64_value = parameters['float64_value']
self.float64_range = parameters['float64_range']
self.float64_choices = parameters['float64_choices']
self.bool_value = parameters['bool_value']
self.string_value = parameters['string_value']
return True
def process(self, inputs, outputs):
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"images": {
"type": "user/2d_array_of_integers/1"
},
"labels": {
"type": "user/floats/1"
}
},
"outputs": {
"features": {
"type": "user/1d_array_of_integers/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def setup(self, parameters):
a = b
return True
def process(self, inputs, outputs):
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"images": {
"type": "user/2d_array_of_integers/1"
},
"labels": {
"type": "user/floats/1"
}
},
"outputs": {
"features": {
"type": "user/1d_array_of_integers/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def setup(self, parameters):
return False
def process(self, inputs, outputs):
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"in_data1": {
"type": "user/single_integer/1"
},
"in_data2": {
"type": "user/single_integer/1"
}
},
"outputs": {
"out_data": {
"type": "user/single_integer/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def process(self, inputs, outputs):
outputs['out_data'].write({
'value': inputs['in_data1'].data.value + \
inputs['in_data2'].data.value
})
return True
{
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"in_data1": {
"type": "user/single_integer/1"
},
"in_data2": {
"type": "user/single_integer/1"
}
},
"outputs": {
"out_data": {
"type": "user/single_integer/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def __init__(self):
self.delayed = True
def process(self, inputs, outputs):
if not(self.delayed):
outputs['out_data'].write({
'value': inputs['in_data1'].data.value + \
inputs['in_data2'].data.value
})
self.delayed = not(self.delayed)
return True
{
"schema_version": 1,
"language": "python",
"splittable": false,
"groups": [
{
"inputs": {
"images": {
"type": "user/2d_array_of_integers/1"
},
"labels": {
"type": "user/floats/1"
}
},
"outputs": {
"features": {
"type": "user/1d_array_of_integers/1"
}
}
}
]
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class Algorithm:
def process(self, inputs, outputs):
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment