示例#1
0
 def test_add(self):
     genome_a = Genome(self.genes_dict)
     genome_a.score = 1
     genome_b = Genome(self.genes_dict)
     genome_b.score = 2
     genome_c = genome_a + genome_b
     assert genome_c.score is None
示例#2
0
 def test_mutate(self):
     genome = Genome(self.genes_dict, mutation_probability=1)
     has_mutated = genome.mutate()
     assert has_mutated == True
     genome_b = Genome(self.genes_dict, mutation_probability=0)
     has_mutated = genome_b.mutate()
     assert has_mutated == False
示例#3
0
 def test_to_json(self):
     genome = Genome(self.genes_dict)
     genome.to_json()
示例#4
0
 def test_get_hash(self):
     genome = Genome(self.genes_dict)
     genome.get_hash()
示例#5
0
 def test_list_value(self):
     genome = Genome(self.genes_dict)
     list_value = genome.list_value()
示例#6
0
 def test_dict_value(self):
     genome = Genome(self.genes_dict)
     dict_value = genome.dict_value()