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


Python User.get_status方法代码示例

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


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

示例1: test_exact_infection1

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_exact_infection1(self):
     a = User('A')
     b = User('B')
     c = User('C')
     d = User('D')
     e = User('E')
     f = User('F')
     user_lst = [a, b, c, d]
     e.add_student(f)
     a.add_coach(b)
     b.add_student(c)
     d.add_student(a)
     self.assertEqual(a.get_status(), 'Clean')
     self.assertEqual(b.get_status(), 'Clean')
     self.assertEqual(c.get_status(), 'Clean')
     self.assertEqual(d.get_status(), 'Clean')
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     result = infections.exact_infection(a, 4)
     self.assertTrue(result)
     infected_count = 0
     for user in user_lst:
         infected_count += user.get_status_num()
     self.assertEqual(infected_count, 4)
     result = infections.exact_infection(f, 10)
     self.assertFalse(result)
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
开发者ID:chenhoward,项目名称:infections,代码行数:30,代码来源:unit_test.py

示例2: test_user_creation

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_user_creation(self):
     u = User('A')
     self.assertEqual(u.get_name(), 'A')
     self.assertEqual(u.get_status(), 'Clean')
     v = User('B')
     u.add_student(v)
     self.assertTrue(v in u.get_students())
开发者ID:chenhoward,项目名称:infections,代码行数:9,代码来源:unit_test.py

示例3: test_total_infection_rand

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_total_infection_rand(self):
     users = []
     user_num = 50
     for i in xrange(user_num):
         user = User(i)
         users.append(user)
         coaching = random.randint(0, 1)
         if i:
             related_user = users[random.randint(0, i - 1)]
             if coaching:
                 user.add_student(related_user)
             else:
                 user.add_coach(related_user)
     for user in users:
         self.assertEqual(user.get_status(), 'Clean')
     user = users[random.randint(0, user_num - 1)]
     infections.total_infection(user)
     for user in users:
         self.assertEqual(user.get_status(), 'Infected')
开发者ID:chenhoward,项目名称:infections,代码行数:21,代码来源:unit_test.py

示例4: test_limited_infection1

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_limited_infection1(self):
     a = User('A')
     b = User('B')
     c = User('C')
     d = User('D')
     e = User('E')
     f = User('F')
     e.add_student(f)
     a.add_coach(b)
     b.add_student(c)
     d.add_student(a)
     self.assertEqual(a.get_status(), 'Clean')
     self.assertEqual(b.get_status(), 'Clean')
     self.assertEqual(c.get_status(), 'Clean')
     self.assertEqual(d.get_status(), 'Clean')
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     infections.limited_infection(a, 3)
     self.assertEqual(a.get_status(), 'Infected')
     self.assertEqual(b.get_status(), 'Infected')
     self.assertEqual(c.get_status(), 'Clean')
     self.assertEqual(d.get_status(), 'Infected')
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     infections.limited_infection(f, 0)
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     infections.limited_infection(f, 10)
     self.assertEqual(e.get_status(), 'Infected')
     self.assertEqual(f.get_status(), 'Infected')
开发者ID:chenhoward,项目名称:infections,代码行数:32,代码来源:unit_test.py

示例5: test_total_infection1

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_total_infection1(self):
     a = User()
     b = User()
     c = User()
     d = User()
     e = User()
     f = User()
     e.add_student(f)
     a.add_coach(b)
     b.add_student(c)
     d.add_student(a)
     self.assertEqual(a.get_status(), 'Clean')
     self.assertEqual(b.get_status(), 'Clean')
     self.assertEqual(c.get_status(), 'Clean')
     self.assertEqual(d.get_status(), 'Clean')
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     infections.total_infection(a)
     self.assertEqual(a.get_status(), 'Infected')
     self.assertEqual(b.get_status(), 'Infected')
     self.assertEqual(c.get_status(), 'Infected')
     self.assertEqual(d.get_status(), 'Infected')
     self.assertEqual(e.get_status(), 'Clean')
     self.assertEqual(f.get_status(), 'Clean')
     infections.total_infection(f)
     self.assertEqual(e.get_status(), 'Infected')
     self.assertEqual(f.get_status(), 'Infected')
开发者ID:chenhoward,项目名称:infections,代码行数:29,代码来源:unit_test.py

示例6: test_user_infect

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_status [as 别名]
 def test_user_infect(self):
     a = User()
     a.infect()
     self.assertEqual(a.get_status(), 'Infected')
     b = User(None, a)
     self.assertEqual(b.get_status(), 'Infected')
开发者ID:chenhoward,项目名称:infections,代码行数:8,代码来源:unit_test.py


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