コード例 #1
0
 def test_value_shortcut(self):
     self.assertEqual(
         'foo',
         batch_project.executeParamSpec('test_value_spec', 'foo', {}, {},
                                        'test_node', []))
     self.assertEqual(
         1,
         batch_project.executeParamSpec('test_value_spec', {
             'type': 'value',
             'value': '{foo}',
             'function': 'numpy.int'
         }, {'foo': 1}, {}, 'test_node', []))
     self.assertEqual(
         1,
         batch_project.executeParamSpec('test_value_spec', {
             'type': 'value',
             'value': '{foo@nodex}',
             'function': 'numpy.int'
         }, {'foo': 2}, {'nodex': {
             'foo': 1
         }}, 'test_node', []))
     self.assertEqual(
         '2,331.23',
         batch_project.executeParamSpec('test_value_spec', {
             'type': 'value',
             'value': '{foo@nodex:,}'
         }, {'foo': 2}, {'nodex': {
             'foo': 2331.23
         }}, 'test_node', []))
コード例 #2
0
 def test_int_picker(self):
     manager = PermuteGroupManager()
     global_state = {
         'iteratorslock': Lock(),
         'permutegroupsmanager': manager
     }
     local_state = {}
     spec = {"type": "int[5:11:2]", 'permutegroup': 'yes'}
     manager.next()
     self.assertEqual(
         5,
         batch_project.executeParamSpec('test_int_spec', spec, global_state,
                                        local_state, 'test_node', []))
     manager.next()
     self.assertEqual(
         7,
         batch_project.executeParamSpec('test_int_spec', spec, global_state,
                                        local_state, 'test_node', []))
     manager.next()
     self.assertEqual(
         9,
         batch_project.executeParamSpec('test_int_spec', spec, global_state,
                                        local_state, 'test_node', []))
     manager.next()
     self.assertEqual(
         11,
         batch_project.executeParamSpec('test_int_spec', spec, global_state,
                                        local_state, 'test_node', []))
コード例 #3
0
 def test_float_picker(self):
     manager = PermuteGroupManager()
     global_state = {
         'iteratorslock': Lock(),
         'image_dir': self.locateFile('test/images'),
         'permutegroupsmanager': manager
     }
     local_state = {}
     spec = {"type": "float[5.1:7:0.5]", 'permutegroup': 'yes'}
     manager.next()
     self.assertEqual(
         5.1,
         batch_project.executeParamSpec('test_float_spec', spec,
                                        global_state, local_state,
                                        'test_node', []))
     manager.next()
     self.assertEqual(
         5.6,
         batch_project.executeParamSpec('test_float_spec', spec,
                                        global_state, local_state,
                                        'test_node', []))
     manager.next()
     self.assertEqual(
         6.1,
         batch_project.executeParamSpec('test_float_spec', spec,
                                        global_state, local_state,
                                        'test_node', []))
     manager.next()
     self.assertEqual(
         6.6,
         batch_project.executeParamSpec('test_float_spec', spec,
                                        global_state, local_state,
                                        'test_node', []))
コード例 #4
0
 def test_list_picker(self):
     manager = PermuteGroupManager()
     global_state = {
         'iteratorslock': Lock(),
         'image_dir': self.locateFile('test/images'),
         'permutegroupsmanager': manager
     }
     local_state = {}
     spec = {"type": "list", 'values': ['1', '2', '3']}
     self.assertTrue(
         batch_project.executeParamSpec(
             'test_list_spec', spec, global_state, local_state, 'test_node',
             []) in ['1', '2', '3'])
     self.assertTrue(
         batch_project.executeParamSpec(
             'test_list_spec', spec, global_state, local_state, 'test_node',
             []) in ['1', '2', '3'])
     self.assertTrue(
         batch_project.executeParamSpec(
             'test_list_spec', spec, global_state, local_state, 'test_node',
             []) in ['1', '2', '3'])
     self.assertTrue(
         batch_project.executeParamSpec(
             'test_list_spec', spec, global_state, local_state, 'test_node',
             []) in ['1', '2', '3'])