Generating all permutations of a sequence
Imports should always be at the top of the file. I would make an exception for those that are needed only if __name__ == '__main__', but in that case they should be within that block. So your code should look like:

import itertools

def permutation_lib(iterable):
   ...

def permutation(iterable):
    ...

def insert_at(iterable, idx, value):
    ...

if __name__ == '__main__':

    import unittest

    class TestPermutation(unittest.TestCase):
        ...

    unittest.main()


which also means that when you import from this script you don't get the test class, or have import unittest at the top with import itertools.



None of your functions/classes/methods have docstrings. Including these to explain what each one does, and even document the parameters, return values, etc. (I like the Google style for this) makes your code easier to follow.



You have one test method with two assertions covering three functions. Does this not seem odd to you? If that method fails, where do you look for the problem? I would suggest factoring out permutation_lib entirely (which also means you can move import itertools to the testing block) and testing insert_at on its own in a separate method.