def METHOD_NAME(self):
    stdout = io.StringIO()
    stderr = io.StringIO()
    with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
        print_msg("foo", "bar", print_to="stdout")
    self.assertEqual("foo bar\n", stdout.getvalue())
    self.assertEqual("", stderr.getvalue())