本文整理汇总了Python中team.Team.add_player方法的典型用法代码示例。如果您正苦于以下问题:Python Team.add_player方法的具体用法?Python Team.add_player怎么用?Python Team.add_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类team.Team
的用法示例。
在下文中一共展示了Team.add_player方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from team import Team [as 别名]
# 或者: from team.Team import add_player [as 别名]
def __init__(self, games, schoolA, schoolB, playersA, playersB):
self.games = games
teamA = Team(schoolA)
teamB = Team(schoolB)
for player in playersA.split(","): #splitting the names by the comma (in the input-Kevin:1,) and adding it to the player list
teamA.add_player(player)
for player in playersB.split(","): #same thing with the opponent
teamB.add_player(player)
self.teamA = teamA
self.teamB = teamB
self.playersA = playersA
self.playersB = playersB
示例2: TeamTest
# 需要导入模块: from team import Team [as 别名]
# 或者: from team.Team import add_player [as 别名]
class TeamTest(unittest.TestCase):
def setUp(self):
self.player1 = Player(None, None)
self.team = Team("test", bullet.btVector3(0, 0, 0), [self.player1], "ignore", 0)
def test_add_player(self):
p2 = Player(None, None)
self.team.add_player(p2)
self.assertIn(p2, self.team.players)
def test_remove_player(self):
self.team.remove_player(self.player1)
self.assertNotIn(self.player1, self.team.players)
def test_add_score(self):
self.team.add_score(5)
self.assertEqual(self.team.score, 5)
示例3: test_add_player
# 需要导入模块: from team import Team [as 别名]
# 或者: from team.Team import add_player [as 别名]
def test_add_player(self):
teamA = Team("Cate")
playerA = Player("Kevin")
teamA.add_player(playerA)
self.assertEqual([playerA],teamA.players)