本文整理汇总了Python中species.Species.fat_storage方法的典型用法代码示例。如果您正苦于以下问题:Python Species.fat_storage方法的具体用法?Python Species.fat_storage怎么用?Python Species.fat_storage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类species.Species
的用法示例。
在下文中一共展示了Species.fat_storage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_eat
# 需要导入模块: from species import Species [as 别名]
# 或者: from species.Species import fat_storage [as 别名]
def test_can_eat(self):
self.assertFalse(self.species_1.can_eat())
self.assertTrue(self.species_4.can_eat())
fat_tissue = Species(4, 3, 4, [TraitCard("fat-tissue")], 3)
self.assertTrue(fat_tissue.can_eat())
fat_tissue.fat_storage = 4
self.assertFalse(fat_tissue.can_eat())
示例2: json_to_species
# 需要导入模块: from species import Species [as 别名]
# 或者: from species.Species import fat_storage [as 别名]
def json_to_species(cls, json_species):
assert(cls.validate_species_json(json_species))
species_food = json_species[0][1]
species_body = json_species[1][1]
species_pop = json_species[2][1]
species_traits = []
for trait in json_species[3][1]:
species_traits.append(cls.json_to_trait(trait))
species_obj = Species(species_pop, species_food, species_body, species_traits)
if len(json_species) == 5:
species_obj.fat_storage = json_species[4][1]
return species_obj