'Checks if print_types outputs `signature` when func is called with *args and **kwargs.
Do not decorate func with print_types before passing into this function.
func will be decorated with print_types within this function.'

def check_signature(self, signature, retval, func, *args, **kwargs):

    try:
        original_stdout = sys.stdout
        sys.stdout = StringIO()
        self.assertEqual(retval, print_types(func)(*args, **kwargs))
        self.assertEqual(sys.stdout.getvalue().strip(), signature)
    finally:
        sys.stdout = original_stdout
