本文整理汇总了Python中user.User.remove_coach方法的典型用法代码示例。如果您正苦于以下问题:Python User.remove_coach方法的具体用法?Python User.remove_coach怎么用?Python User.remove_coach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.remove_coach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_user_remove_single_coach
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import remove_coach [as 别名]
def test_user_remove_single_coach(self):
"""
Tests removing a coach from a user's coaches
"""
u1 = User("u1", 1)
u2 = User("u2", 1)
u1.add_coach(u2)
u1.remove_coach(u2)
self.assertEqual(len(u1.coaches), 0)
self.assertFalse(u2 in u1.coaches)
self.assertFalse(u1 in u2.students)
示例2: remove_coach
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import remove_coach [as 别名]
def remove_coach(self, other):
"""
Removes the coach from self.coaches and removes the edge for the graph connection
:param other: Coach to remove
:type other: VisualUser
:return: None
"""
User.remove_coach(self, other)
for edge in other.edges:
if edge.node1 == other.node and edge.node2 == self.node:
other.edges.remove(edge)
示例3: test_user_double_remove_coach
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import remove_coach [as 别名]
def test_user_double_remove_coach(self):
"""
Tests that an error is raised when double removing a coach
"""
u1 = User("u1", 1)
u2 = User("u2", 1)
u1.add_coach(u2)
u1.remove_coach(u2)
self.assertRaises(MissingCoachError, u1.remove_coach, u2)
self.assertEqual(len(u1.coaches), 0)
self.assertFalse(u1 in u2.students)
self.assertFalse(u2 in u1.coaches)
示例4: test_user_remove_multiple_coaches_same_name
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import remove_coach [as 别名]
def test_user_remove_multiple_coaches_same_name(self):
"""
Tests removing multiple coaches with the same name
"""
u1 = User("u1", 1)
u2 = User("u2", 1)
u3 = User("u2", 1)
u1.add_coach(u2)
u1.add_coach(u3)
u1.remove_coach(u2)
self.assertEqual(len(u1.coaches), 1)
self.assertFalse(u2 in u1.coaches)
self.assertTrue(u3 in u1.coaches)
self.assertFalse(u1 in u2.students)
self.assertTrue(u1 in u3.students)