def test_insert_pathfail(self): """Should raise ValueError when given generator (5) > self.largestGenerator (4) and should not modify word.""" bw = BraidWord([1, 2, 3, 4]) with self.assertRaises(ValueError) as cm: bw.insert(2, 5) # (No) Word modification self.assertEqual(bw.word, [1, 2, 3, 4])
def test_insert_pathsuccess(self): """Should successfully insert generator (3) @idx 2 and should modify word and genCount.""" bw = BraidWord([1, 2, 3, 4]) # Execution path True self.assertTrue(bw.insert(2, 3)) # Word modification self.assertEqual(bw.word, [1, 2, -3, 3, 3, 4]) # genCount modification self.assertEqual(bw.genCount, [1, 1, 3, 1])