Пример #1
0
 def test_pop_back(self):
     ''' Must make the image with next smaller index active when the active is poped'''
     chain.Insert_Image_Before(self.p_state)  # add before active
     self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
     chain.Pop_Back(self.p_state)  # delete the last (active)
     self.assertEqual(system.Get_Index(self.p_state), 0)  # active is 0th
     self.assertEqual(chain.Get_NOI(self.p_state), 1)  # total 1 image
Пример #2
0
 def test_Rx(self):
     chain.Insert_Image_Before(self.p_state)  # active is 1st
     noi = chain.Get_NOI(self.p_state)  # total 2 images
     self.assertAlmostEqual(noi, 2)
     Rx = chain.Get_Rx(self.p_state)  # get Rx values
     Rx_interp = chain.Get_Rx_Interpolated(self.p_state)  # get Rx interpol
     self.assertNotAlmostEqual(Rx[noi - 1], 0)
Пример #3
0
 def test_jump(self):
     ''' Must change the active image to the one pointed by idx_image'''
     chain.Insert_Image_Before(self.p_state)  # active is 1st
     chain.Jump_To_Image(self.p_state, idx_image=0)  # jump to 0th
     self.assertEqual(system.Get_Index(self.p_state), 0)  # active is 0th
     chain.Jump_To_Image(self.p_state, idx_image=1)  # jump to 1st
     self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
Пример #4
0
    def test_delete_outoflimits(self):

        chain.Insert_Image_Before(self.p_state)  # active is 1st
        chain.Insert_Image_Before(self.p_state)  # active is 2nd
        self.assertEqual(system.Get_Index(self.p_state), 2)  # active is 2nd
        self.assertEqual(chain.Get_NOI(self.p_state), 3)  # total 3 images

        # test the deletion of a non existing image with positive idx
        chain.Delete_Image(self.p_state,
                           idx_image=5)  # delete -5th (not exist)
        self.assertEqual(chain.Get_NOI(self.p_state), 3)  # total 3 images

        # test the deletion of a non existing image with negative idx
        chain.Delete_Image(self.p_state,
                           idx_image=-5)  # delete -5th (not exist)
        self.assertEqual(chain.Get_NOI(self.p_state), 2)  # total 2 images
        self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
Пример #5
0
 def test_switching(self):
     ''' For Next in the back and Prev in the front active must remain unchanged'''
     chain.Insert_Image_Before(self.p_state)  # add before active
     self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
     chain.Next_Image(self.p_state)  # no next image
     self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
     chain.Prev_Image(self.p_state)  # go to prev image
     self.assertEqual(system.Get_Index(self.p_state), 0)  # active is 0th
     chain.Prev_Image(self.p_state)  # no prev image
     self.assertEqual(system.Get_Index(self.p_state), 0)  # active is 0th
Пример #6
0
 def test_insert_before(self):
     ''' Must reindex (increment by one) active image '''
     chain.Insert_Image_Before(self.p_state)  # add before active
     self.assertEqual(chain.Get_NOI(self.p_state), 2)  # total 2 images
     self.assertEqual(system.Get_Index(self.p_state), 1)  # active is 1st
Пример #7
0
 def test_remove_largest_index_active(self):
     ''' Must set the active to the image with the smallest index left'''
     chain.Insert_Image_Before(self.p_state)  # active is 1st
     chain.Delete_Image(self.p_state)  # delete 1st
     self.assertEqual(chain.Get_NOI(self.p_state), 1)  # total 1 image
     self.assertEqual(system.Get_Index(self.p_state), 0)  # active is 0th