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


Python Team.wr_count方法代码示例

本文整理汇总了Python中models.Team.wr_count方法的典型用法代码示例。如果您正苦于以下问题:Python Team.wr_count方法的具体用法?Python Team.wr_count怎么用?Python Team.wr_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Team的用法示例。


在下文中一共展示了Team.wr_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bench_test

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import wr_count [as 别名]
    def bench_test(self):
        User.objects.create_user("dillen", "[email protected]", "letmein")
        
        team1 = Team(team_name="Winners",owner=User.objects.get(username__exact="dillen"))

        p1 = Player(full_name="abc1",position="WR",team=team1,benched=False)
        p2 = Player(full_name="abc2",position="WR",team=team1,benched=False)
        team1.wr_count = 2
        p3 = Player(full_name="abc3",position="WR",team=team1)
        p4 = Player(full_name="abc4",position="WR")
        
        team1.save()
        p1.save()
        p2.save()
        p3.save()
        p4.save()
        
        #Bench someone already benched
        self.assertEqual(bench(p3),False)
        self.assertEqual(team1.wr_count,2)
        self.assertEqual(p3.benched,True)
        
        #Bench someone not on a team
        self.assertEqual(bench(p4),False)
        self.assertEqual(team1.wr_count,2)
        self.assertEqual(p4.benched,True)
        
        #Bench a WR
        self.assertEqual(bench(p2),False)
        self.assertEqual(team1.wr_count,1)
        self.assertEqual(p1.benched,False)
        self.assertEqual(p2.benched,True)
开发者ID:epkatz,项目名称:7-Fantasy-Football,代码行数:34,代码来源:tests.py

示例2: test_play

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import wr_count [as 别名]
    def test_play(self):
        User.objects.create_user("dillen", "[email protected]", "letmein")
        User.objects.create_user("eli", "[email protected]", "letmein")
        
        team1 = Team(team_name="Winners",owner=User.objects.get(username__exact="dillen"))

        p1 = Player(full_name="abc1",position="WR",team=team1,benched=False)
        team1.wr_count = 1
        p2 = Player(full_name="abc2",position="WR",team=team1)
        p3 = Player(full_name="abc3",position="WR")
        p4 = Player(full_name="abc4",position="QB",team=team1,benched=False)
        team1.qb_count = 1
        p5 = Player(full_name="abc5",position="QB",team=team1)
        
        team1.save()
        p1.save()
        p2.save()
        p3.save()
        p4.save()
        p5.save()
        
        #Wrong position
        self.assertEqual(play(p2,"QB"),False)
        self.assertEqual(p2.benched,True)
        self.assertEqual(team1.qb_count,1)
        
        #Already playing
        self.assertEqual(play(p1,"WR"),False)
        self.assertEqual(p1.benched,False)
        self.assertEqual(team1.wr_count,1)
        
        #Not on a team
        self.assertEqual(play(p3,"WR"),False)
        self.assertEqual(p3.team, None)
        self.assertEqual(p3.benched, True)
        self.assertEqual(team1.wr_count,1)
        
        #2 QB's at the same time
        self.assertEqual(play(p5,"QB"),False)
        self.assertEqual(p4.benched, False)
        self.assertEqual(p5.benched, True)
        self.assertEqual(team1.qb_count,1)
        
        #2 WR's at the same time (valid)
        self.assertEqual(play(p2,"WR"),True)
        self.assertEqual(p2.benched, False)
        self.assertEqual(team1.wr_count,2)
开发者ID:epkatz,项目名称:7-Fantasy-Football,代码行数:49,代码来源:tests.py


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