What do you want to test?
If the answer is that you want to test that your code interacts with gatttool in the way you expect, then just try it.
If the answer is that you want to test whether you're using pexpect correctly, then I suggest that you write an external program that just records what you send to it and replies with some text that you expect (probably the responses expected from gatttool). Then run that instead of gatttool in your tests. For example, you can make your connect
function accept parameters for the strings to pass to pexpect functions - different things for your external test program or for gatttool.
Even if you are using pexpect correctly and you can successfully interact with gatttool, you should consider what happens if gatttool responds in an unexpected way. Your connection to it might drop, or it might respond in a different way to normal. A test external program would also let you test that something sensible happens in those cases.