本文整理匯總了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