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


Python Animal.is_pregnant方法代码示例

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


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

示例1: test_actions_with_pregnant_one

# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import is_pregnant [as 别名]
 def test_actions_with_pregnant_one(self):
     yana_tiger = Animal("tiger", 8, "Yana", "female", 30)
     yana_tiger.is_pregnant = True
     self.zoopark.animals.append(yana_tiger)
     self.zoopark.actions_with_pregnant_one(5)
     self.assertEqual(yana_tiger.gestination_period, 5)
     self.assertEqual(len(self.zoopark.animals), 1)
     self.assertEqual(yana_tiger.relax_period, 8)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:10,代码来源:zoo_test.py

示例2: test_make_reproduction_moves_false2_one_couple

# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import is_pregnant [as 别名]
 def test_make_reproduction_moves_false2_one_couple(self):
     yana_tiger = Animal("tiger", 5, "Yana", "female", 30)
     yana_tiger.is_pregnant = True
     yana_tiger.gestination_period = 4
     self.zoopark.animals.append(yana_tiger)
     gosho_tiger = Animal("tiger", 4, "Gosho", "male", 30)
     self.zoopark.animals.append(gosho_tiger)
     self.zoopark.make_reproduction_moves()
     self.assertEqual(yana_tiger.gestination_period, 4)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:11,代码来源:zoo_test.py

示例3: test_actions_with_pregnant_one_new_baby

# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import is_pregnant [as 别名]
 def test_actions_with_pregnant_one_new_baby(self):
     yana_tiger = Animal("tiger", 8, "Yana", "female", 30)
     yana_tiger.is_pregnant = True
     self.zoopark.animals.append(yana_tiger)
     self.zoopark.actions_with_pregnant_one(8)
     self.assertEqual(yana_tiger.gestination_period, 0)
     self.assertEqual(len(self.zoopark.animals), 2)
     self.assertEqual(yana_tiger.relax_period, 2)
     baby = self.zoopark.animals[1]
     self.assertEqual(baby.age, 2)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:12,代码来源:zoo_test.py

示例4: test_grow

# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import is_pregnant [as 别名]
 def test_grow(self):
     self.puh_panda.grow(5)
     self.assertEqual(self.puh_panda.age, 25)
     self.assertEqual(self.puh_panda.weight, 101.5)
     self.assertEqual(self.puh_panda.relax_period, 25)
     self.assertEqual(self.puh_panda.gestination_period, 0)
     yana_tiger = Animal("tiger", 5, "Yana", "female", 30)
     yana_tiger.is_pregnant = True
     yana_tiger.grow(5)
     self.assertEqual(yana_tiger.relax_period, 0)
     ivo_tiger = Animal("tiger", 5, "Ivo", "female", 101)
     ivo_tiger.grow(5)
     #cannot get bigger anymore, it is fat enough
     self.assertEqual(ivo_tiger.weight, 101)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:16,代码来源:animal_test.py

示例5: test_pregnance_reqs_female_false2

# 需要导入模块: from animal import Animal [as 别名]
# 或者: from animal.Animal import is_pregnant [as 别名]
 def test_pregnance_reqs_female_false2(self):
     yana_tiger = Animal("tiger", 8, "Yana", "female", 30)
     yana_tiger.is_pregnant = True
     self.zoopark.animals.append(yana_tiger)
     self.assertFalse(self.zoopark._pregnance_reqs_female(yana_tiger))
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:7,代码来源:zoo_test.py


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