本文整理匯總了Python中species.Species.setTraits方法的典型用法代碼示例。如果您正苦於以下問題:Python Species.setTraits方法的具體用法?Python Species.setTraits怎麽用?Python Species.setTraits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類species.Species
的用法示例。
在下文中一共展示了Species.setTraits方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestUtils
# 需要導入模塊: from species import Species [as 別名]
# 或者: from species.Species import setTraits [as 別名]
class TestUtils(unittest.TestCase):
def setUp(self):
self.species1 = Species(0, 1, 3, [])
self.carni2 = Species(0, 2, 3, [Trait.carnivore])
self.herbavore = Species(0, 1, 1, [])
self.herbavore2 = Species(0, 1, 1, [])
self.herbavore3 = Species(1, 1, 1, [])
self.herbavore4 = Species(2, 1, 2, [])
self.fat_tissue = Species(0, 1, 1, [])
self.fat_tissue.setTraits([Trait.fat_tissue])
self.fat_tissue2 = Species(0, 3, 1, [])
self.fat_tissue2.setTraits([Trait.fat_tissue])
self.opherb = Species(0, 1, 1, [])
self.opfatherb = Species(0, 7, 1, [])
self.fertileCard = TraitCard(Trait.fertile, 2)
self.climbingCard = TraitCard(Trait.climbing, 0)
self.cooperationCard = TraitCard(Trait.cooperation, 0)
self.carnivoreCard = TraitCard(Trait.carnivore, 0)
self.longNeckCard = TraitCard(Trait.long_neck, 0)
self.ambushCard = TraitCard(Trait.ambush, 0)
self.burrowingCard = TraitCard(Trait.burrowing, 0)
self.cooperation2Card = TraitCard(Trait.cooperation, -1)
self.player1 = Player(1, [], 0)
self.player2 = Player(2, [], 0)
self.player3 = Player(3, [], 0)
self.validAction1 = [2, [[2, 6]], [[2, 3]], [[5, 4]], [[2, 0, 0]]]
self.validAction2 = [2, [[2, 0]], [[2, 1]], [[4, 3]], []]
self.validAction3 = [2, [[2, 1]], [], [[3, 0]], []]
self.validAction4 = [2, [], [], [[0, 1]], []]
self.validAction5 = [0, [], [], [], []]
self.invalidAction1 = ["hi", 1, [], "so", False]
self.invalidAction2 = ["hi", 1, []]
self.invalidAction3 = [False, [["2", 6]], [[2, 3]], [[5, 4]], [[2, 0, 0]]]
self.validFeeding1 = False
self.validFeeding2 = 1
self.validFeeding3 = [1, 9]
self.validFeeding4 = [0, 0, 1]
self.invalidFeeding1 = True
self.invalidFeeding2 = [1, 2, 3, 3, ""]
self.invalidFeeding3 = ["p", "i", "e"]
def tearDown(self):
del self.species1
del self.carni2
del self.herbavore
del self.herbavore2
del self.herbavore3
del self.herbavore4
del self.fat_tissue
del self.fat_tissue2
del self.opherb
del self.opfatherb
del self.fertileCard
del self.climbingCard
del self.cooperationCard
del self.carnivoreCard
del self.longNeckCard
del self.ambushCard
del self.burrowingCard
del self.cooperation2Card
del self.player1
del self.player2
del self.player3
del self.validAction1
del self.validAction2
del self.validAction3
del self.validAction4
del self.validAction5
def testValidateAction1(self):
# test 1
self.player1.setHand([self.fertileCard, self.longNeckCard, self.ambushCard])
self.player1.setSpeciesBoards([self.species1, self.carni2])
self.assertTrue(validateAction4(self.validAction4, self.player1))
def testValidateAction2(self):
# test 2
self.player2.setHand([self.fertileCard, self.longNeckCard, self.ambushCard, self.cooperationCard])
self.player2.setSpeciesBoards([self.species1, self.carni2])
self.assertTrue(validateAction4(self.validAction3, self.player2))
def testValidateAction3(self):
#.........這裏部分代碼省略.........