def test_can_sort_seventh_case(self):
     sort = Sorting(SEVENTH_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 5, 45])
 def test_can_sort_negtive_values(self):
     sort = Sorting(FIFTH_CASE)
     self.assertEqual(sort.insertion_sort(), [-44, -7, -1, 0, 5, 56])
 def test_can_sort_float_values(self):
     sort = Sorting(SIXTH_CASE)
     self.assertEqual(sort.insertion_sort(),
                      [0.05, 0.5, 1.5, 1.6, 3.4, 7.5])
 def test_can_sort_third_case(self):
     sort = Sorting(THIRD_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 1, 2, 4, 8, 45])
 def test_can_sort_fourth_case(self):
     sort = Sorting(FOURTH_CASE)
     self.assertEqual(sort.insertion_sort(), [1, 3, 5, 45])
 def test_can_resolv_words(self):
     sort = Sorting([1, '45', 3, 'erf', '5'])
     self.assertEqual(sort.convert_to_array_of_int(), [1, 45, 3, 5])
 def test_can_sort_second_case(self):
     sort = Sorting(SECOND_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 1, 2, 4, 8, 45])
 def test_can_sort_first_case(self):
     sort = Sorting(FIRST_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 4, 7])
 def test_can_convert_str_to_int(self):
     sort = Sorting([0, 1, '2', '45'])
     self.assertEqual(sort.convert_to_array_of_int(), [0, 1, 2, 45])
 def test_raise_when_create_not_from_list(self):
     with self.assertRaises(TypeError):
         Sorting(3)
 def test_sorting_should_be_list(self):
     arr = [3]
     self.assertTrue(Sorting(arr))
 def test_init_param_list(self):
     arr = [1, 2, 3]
     self.assertEqual(arr, Sorting(arr).array)
 def test_can_create_sorting(self):
     sorting = Sorting([])
     self.assertTrue(isinstance(sorting, Sorting))
Beispiel #14
0
    @studentName.setter   
    def studentName(self,newName):
        '''
        Setter for the student name
        :parameter: the new name
        '''
        self.__studentName = newName
        
    @studentName.deleter
    def studentName(self):
        del self.__studentName


if __name__ == '__main__':
    l = [2, 1, 3]
    Sorting.sort(l)
    assert (l == [1, 2, 3])

    l = [2, 1, 4,3,-1]
    Sorting.sort(l)
    assert (l == [-1,1,2,3,4])
    
    l=[-3,4,0,-1]
    Sorting.sort(l)
    assert(l==[-3,-1,0,4])
        
        
    st1=Student(3,"Mary")
    st2=Student(1,"Anne")
    st3=Student(2,"Eric")
    st4=Student(4,"Christian")