当前位置: 首页>>代码示例>>Python>>正文


Python Team.add_player方法代码示例

本文整理汇总了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
开发者ID:juliasgan,项目名称:tennis_tracker,代码行数:18,代码来源:set.py

示例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)
开发者ID:kyphelps,项目名称:pynecraft,代码行数:20,代码来源:team_test.py

示例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)
开发者ID:juliasgan,项目名称:tennis_tracker,代码行数:7,代码来源:test_team.py


注:本文中的team.Team.add_player方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。