Ejemplo n.º 1
0
 def setUp(self):
     self.analytics = Analytics()
     self.cells = {
         (0,0,0): Cell((0,0,0),0,0,0,0,0,50,10**5),
         (0,0,1): Cell((0,0,1),0,0,0,0,0,50,10**5),
         (0,1,0): Cell((0,1,0),1,0,0,0,0,50,10**5),
         (0,1,1): Cell((0,1,1),1,0,0,0,0,50,10**5),
         (1,0,0): Cell((1,0,0),0,1,0,0,0,50,10**5),
         (1,0,1): Cell((1,0,1),0,1,0,0,0,50,10**5),
         (1,1,0): Cell((1,1,0),0,0,1,0,0,50,10**5),
         (1,1,1): Cell((1,1,1),0,0,1,0,0,50,10**5),
         (0,0,2): Cell((0,0,2),0,0,0,1,0,50,10**5),
         (0,2,0): Cell((0,2,0),0,0,0,1,0,50,10**5),
         (0,2,2): Cell((0,2,2),0,0,0,0,1,50,10**5),
         (2,0,0): Cell((2,0,0),0,0,0,0,1,50,10**5),
         (2,0,2): Cell((2,0,2),1,1,1,1,1,50,10**5),
         (2,2,0): Cell((2,2,0),1,1,1,1,1,50,10**5)
     }
     self.iterations_cells = {
         10: copy.deepcopy(self.cells),
         20: copy.deepcopy(self.cells)
     }
Ejemplo n.º 2
0
 def setUp(self):
     TestCase.setUp(self)
     position = (1, 1, 1)
     self.genome = Genome(1, 1, 1, 1, 1)
     self.cell = Cell(position, 1, 1, 1, 1, 1, 50, 10**5)
Ejemplo n.º 3
0
class TestCell(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        position = (1, 1, 1)
        self.genome = Genome(1, 1, 1, 1, 1)
        self.cell = Cell(position, 1, 1, 1, 1, 1, 50, 10**5)

    def test_get_mutations(self):
        self.assertEqual(self.cell.mutations(), 5)

    def test_decrease_telomer(self):
        self.cell.decrease_telomer()
        self.assertEqual(self.cell.tl, 49)

    def test_increment_base_muration_rate_gi_0(self):
        self.cell.genome.gi = 0
        self.cell.increment_base_muration_rate(10)
        self.assertEqual(self.cell.m, 10**5)

    def test_increment_base_muration_rate_gi_1(self):
        self.cell.increment_base_muration_rate(10)
        self.assertEqual(self.cell.m, 10**5 * 10)

    def test_perform_mitosis(self):
        new_cell = self.cell.perform_mitosis((1, 1, 1), 10**2)
        self.assertEqual(new_cell.genome.sg, self.cell.genome.sg)
        self.assertEqual(new_cell.genome.igi, self.cell.genome.igi)
        self.assertEqual(new_cell.genome.ea, self.cell.genome.ea)
        self.assertEqual(new_cell.genome.ei, self.cell.genome.ei)
        self.assertEqual(new_cell.genome.gi, self.cell.genome.gi)
        self.assertEqual(new_cell.tl, self.cell.tl)
        self.assertEqual(new_cell.m, self.cell.m)

    def test_add_mutations(self):
        self.cell.genome = Genome(0, 0, 0, 0, 0)
        self.cell.m = 1
        self.cell.add_mutations()
        self.assertTrue(self.cell.mutations() == 5)

    def test_string(self):
        self.assertEqual(str(self.cell), "11111")
Ejemplo n.º 4
0
 def test_third_test_False(self):
     result = self.automata.third_test(Cell((0, 0, 0), 0, 0, 0, 0, 0, 0, 0))
     self.assertEqual(result, False)
Ejemplo n.º 5
0
 def test_third_test_True(self):
     result = self.automata.third_test(Cell((0, 0, 0), 0, 0, 0, 1, 0, 50,
                                            0))
     self.assertEqual(result, True)
Ejemplo n.º 6
0
 def test_first_test_True(self):
     result = self.automata.first_test(Cell((0, 0, 0), 1, 0, 0, 0, 0, 0, 0))
     self.assertEqual(result, True)