本文整理汇总了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)
示例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)
示例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)
示例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)
示例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))