@@ -0,0 +1,965 @@
+import unittest%0A%0A%0Adef insertion_sort(seq):%0A    '''%0A    :param seq:%0A    :return: seq%C3%AAncia ordenada%0A%0A    Complexidade:%0A%0A    Tempo = O(n**2)%0A    Mem%C3%B3ria = O(1)%0A    '''%0A%0A    # if seq == sorted(seq):%0A    #         return seq%0A%0A    for i in range(1,len(seq)):%0A        x = i # x  =  atul%0A        y = x -1 # y = anterior%0A%0A        while seq%5Bx%5D %3C seq%5By%5D and x %3E 0:%0A            seq%5Bx%5D, seq%5By%5D = seq%5By%5D, seq%5Bx%5D%0A            y -= 1%0A            x -= 1%0A    return seq%0A%0A%0Aclass OrdenacaoTestes(unittest.TestCase):%0A    def teste_lista_vazia(self):%0A        self.assertListEqual(%5B%5D, insertion_sort(%5B%5D))%0A%0A    def teste_lista_unitaria(self):%0A        self.assertListEqual(%5B1%5D, insertion_sort(%5B1%5D))%0A%0A    def teste_lista_binaria(self):%0A        self.assertListEqual(%5B1, 2%5D, insertion_sort(%5B2, 1%5D))%0A%0A    def teste_lista_binaria(self):%0A        self.assertListEqual(%5B0, 1, 2, 3, 4, 5, 6, 7, 8, 9%5D, insertion_sort(%5B9, 7, 1, 8, 5, 3, 6, 4, 2, 0%5D))%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A%0A

Exe. insertion_sort Ok