本文整理汇总了Python中pypet.Trajectory.v_with_links方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.v_with_links方法的具体用法?Python Trajectory.v_with_links怎么用?Python Trajectory.v_with_links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.Trajectory
的用法示例。
在下文中一共展示了Trajectory.v_with_links方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_not_getting_links
# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import v_with_links [as 别名]
def test_not_getting_links(self):
traj = Trajectory()
traj.f_add_parameter_group('test.test3')
traj.f_add_parameter_group('test2')
traj.test.f_add_link('circle1' , traj.test2)
traj.test2.f_add_link('circle2' , traj.test)
self.assertTrue(traj.test.circle1 is traj.test2)
traj.v_with_links = False
with self.assertRaises(AttributeError):
traj.test.circle1
found = False
for item in traj.test.f_iter_nodes(recursive=True, with_links=True):
if item is traj.test2:
found=True
self.assertTrue(found)
for item in traj.test.f_iter_nodes(recursive=True, with_links=False):
if item is traj.test2:
self.assertTrue(False)
traj.v_with_links=True
self.assertTrue('circle1' in traj)
self.assertFalse(traj.f_contains('circle1', with_links=False))
self.assertTrue('circle1' in traj.test)
self.assertFalse(traj.test.f_contains('circle1', with_links=False))
self.assertTrue(traj.test2.test3 is traj.par.test.test3)
traj.v_with_links = False
with self.assertRaises(AttributeError):
traj.test2.test3
traj.v_with_links = True
self.assertTrue(traj['test2.test3'] is traj.test3)
with self.assertRaises(AttributeError):
traj.f_get('test2.test3', with_links=False)