本文整理汇总了Python中tvb.tests.framework.core.test_factory.TestFactory.import_cff方法的典型用法代码示例。如果您正苦于以下问题:Python TestFactory.import_cff方法的具体用法?Python TestFactory.import_cff怎么用?Python TestFactory.import_cff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tvb.tests.framework.core.test_factory.TestFactory
的用法示例。
在下文中一共展示了TestFactory.import_cff方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user and a test project, saves old configuration and imports a CFF data-set
"""
self.test_user = TestFactory.create_user()
self.test_project = TestFactory.create_project(self.test_user)
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
示例2: test_bad_reference
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def test_bad_reference(self):
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
field = FilterChain.datatype + '.subject'
filters = FilterChain('', [field], [TEST_SUBJECT_A], ['!='])
bad_reference_connectivity = TestFactory.get_entity(self.test_project, Connectivity(), filters)
self.assertRaises(OperationException, self._import_csv_test_connectivity,
bad_reference_connectivity.gid, TEST_SUBJECT_A)
示例3: setUp
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
"""
self.datatypeFactory = DatatypesFactory()
self.test_project = self.datatypeFactory.get_project()
self.test_user = self.datatypeFactory.get_user()
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = TestFactory.get_entity(self.test_project, Connectivity())
self.assertTrue(self.connectivity is not None)
示例4: setUp
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def setUp(self):
"""
Reset the database before each test.
"""
self.import_service = ImportService()
self.flow_service = FlowService()
self.project_service = ProjectService()
self.test_user = TestFactory.create_user()
self.test_project = TestFactory.create_project(self.test_user, name="GeneratedProject", description="test_desc")
self.operation = TestFactory.create_operation(test_user=self.test_user, test_project=self.test_project)
self.adapter_instance = TestFactory.create_adapter(test_project=self.test_project)
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.zip_path = None
示例5: test_project_disk_size
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def test_project_disk_size(self):
project1 = TestFactory.create_project(self.test_user, 'test_proj1')
zip_path = os.path.join(os.path.dirname(tvb_data.__file__), 'connectivity', 'connectivity_66.zip')
TestFactory.import_zip_connectivity(self.test_user, project1, 'testSubject', zip_path)
project2 = TestFactory.create_project(self.test_user, 'test_proj2')
TestFactory.import_cff(test_user=self.test_user, test_project=project2)
projects = self.project_service.retrieve_projects_for_user(self.test_user.id)[0]
self.assertNotEqual(projects[0].disk_size, projects[1].disk_size, "projects should have different size")
for project in projects:
self.assertNotEqual(0, project.disk_size)
self.assertNotEqual('0.0 KiB', project.disk_size_human)
prj_folder = self.structure_helper.get_project_folder(project)
actual_disk_size = self.compute_recursive_h5_disk_usage(prj_folder)[0]
ratio = float(actual_disk_size) / project.disk_size
msg = "Real disk usage: %s The one recorded in the db : %s" % (actual_disk_size, project.disk_size)
self.assertTrue(ratio < 1.4, msg)
示例6: setUp
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a list of BCT adapters;
imports a CFF data-set
"""
self.test_user = TestFactory.create_user("BCT_User")
self.test_project = TestFactory.create_project(self.test_user, "BCT-Project")
### Make sure Connectivity is in DB
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = dao.get_generic_entity(Connectivity, 'John Doe', 'subject')[0]
# make weights matrix symmetric, or else some BCT algorithms will run infinitely:
w = self.connectivity.weights
self.connectivity.weights = w + w.T - numpy.diag(w.diagonal())
algorithms = dao.get_generic_entity(model.Algorithm, 'Brain Connectivity Toolbox', 'group_description')
self.assertTrue(algorithms is not None)
self.assertTrue(len(algorithms) > 5)
self.bct_adapters = []
for algo in algorithms:
self.bct_adapters.append(ABCAdapter.build_adapter(algo))
示例7: setUp
# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import import_cff [as 别名]
def setUp(self):
"""
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a list of BCT adapters;
imports a CFF data-set
"""
self.test_user = TestFactory.create_user("BCT_User")
self.test_project = TestFactory.create_project(self.test_user, "BCT-Project")
### Make sure Connectivity is in DB
TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
self.connectivity = dao.get_generic_entity(Connectivity, 'John Doe', 'subject')[0]
# make weights matrix symmetric, or else some BCT algorithms will run infinitely:
w = self.connectivity.weights
self.connectivity.weights = w + w.T - numpy.diag(w.diagonal())
self.algo_groups = dao.get_generic_entity(model.AlgorithmGroup, 'MatlabAdapter', 'classname')
self.assertTrue(self.algo_groups is not None)
self.assertEquals(6, len(self.algo_groups))
self.bct_adapters = []
for group in self.algo_groups:
self.bct_adapters.append(TestFactory.create_adapter(group, self.test_project))