本文整理汇总了Python中tvb.core.services.flow_service.FlowService.get_analyze_groups方法的典型用法代码示例。如果您正苦于以下问题:Python FlowService.get_analyze_groups方法的具体用法?Python FlowService.get_analyze_groups怎么用?Python FlowService.get_analyze_groups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tvb.core.services.flow_service.FlowService
的用法示例。
在下文中一共展示了FlowService.get_analyze_groups方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FlowServiceTest
# 需要导入模块: from tvb.core.services.flow_service import FlowService [as 别名]
# 或者: from tvb.core.services.flow_service.FlowService import get_analyze_groups [as 别名]
class FlowServiceTest(TransactionalTestCase):
"""
This class contains tests for the tvb.core.services.flow_service module.
"""
def setUp(self):
""" Prepare some entities to work with during tests:"""
self.flow_service = FlowService()
self.test_user = TestFactory.create_user()
self.test_project = TestFactory.create_project(admin=self.test_user)
category = dao.get_uploader_categories()[0]
self.algorithm = dao.store_entity(model.Algorithm(TEST_ADAPTER_VALID_MODULE,
TEST_ADAPTER_VALID_CLASS, category.id))
def tearDown(self):
dao.remove_entity(model.Algorithm, self.algorithm)
def test_get_uploaders(self):
result = self.flow_service.get_upload_algorithms()
self.assertEqual(29, len(result))
found = False
for algo in result:
if algo.classname == self.algorithm.classname and algo.module == self.algorithm.module:
found = True
break
self.assertTrue(found, "Uploader incorrectly returned")
def test_get_analyze_groups(self):
category, groups = self.flow_service.get_analyze_groups()
self.assertEqual(category.displayname, 'Analyze')
self.assertTrue(len(groups) > 1)
self.assertTrue(isinstance(groups[0], model.AlgorithmTransientGroup))
def test_get_visualizers_for_group(self):
_, op_group_id = TestFactory.create_group(self.test_user, self.test_project)
dt_group = dao.get_datatypegroup_by_op_group_id(op_group_id)
result = self.flow_service.get_visualizers_for_group(dt_group.gid)
# Only the discreet is expected
self.assertEqual(1, len(result))
self.assertEqual(DISCRETE_PSE_ADAPTER_CLASS, result[0].classname)
def test_get_launchable_algorithms(self):
factory = DatatypesFactory()
conn = factory.create_connectivity(4)[1]
ts = factory.create_timeseries(conn)
result = self.flow_service.get_launchable_algorithms(ts.gid)
self.assertTrue('Analyze' in result)
self.assertTrue('View' in result)
def test_get_roup_by_identifier(self):
"""
Test for the get_algorithm_by_identifier.
"""
algo_ret = self.flow_service.get_algorithm_by_identifier(self.algorithm.id)
self.assertEqual(algo_ret.id, self.algorithm.id, "ID-s are different!")
self.assertEqual(algo_ret.module, self.algorithm.module, "Modules are different!")
self.assertEqual(algo_ret.fk_category, self.algorithm.fk_category, "Categories are different!")
self.assertEqual(algo_ret.classname, self.algorithm.classname, "Class names are different!")
def test_build_adapter_instance(self):
"""
Test standard flow for building an adapter instance.
"""
adapter = TestFactory.create_adapter(TEST_ADAPTER_VALID_MODULE, TEST_ADAPTER_VALID_CLASS)
self.assertTrue(isinstance(adapter, ABCSynchronous), "Something went wrong with valid data!")
def test_build_adapter_invalid(self):
"""
Test flow for trying to build an adapter that does not inherit from ABCAdapter.
"""
group = dao.get_algorithm_by_module(TEST_ADAPTER_VALID_MODULE, TEST_ADAPTER_INVALID_CLASS)
self.assertRaises(IntrospectionException, ABCAdapter.build_adapter, group)
def test_prepare_adapter(self):
"""
Test preparation of an adapter.
"""
stored_adapter = dao.get_algorithm_by_module(TEST_ADAPTER_VALID_MODULE, TEST_ADAPTER_VALID_CLASS)
interface = self.flow_service.prepare_adapter(self.test_project.id, stored_adapter)
self.assertTrue(isinstance(stored_adapter, model.Algorithm), "Something went wrong with valid data!")
self.assertTrue("name" in interface[0], "Bad interface created!")
self.assertEquals(interface[0]["name"], "test", "Bad interface!")
self.assertTrue("type" in interface[0], "Bad interface created!")
#.........这里部分代码省略.........