def test_issue_15(self):
        """query should be expanded before perform character encoding"""
        conn = self.connect()
        c = conn.cursor()
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore")
            c.execute("drop table if exists issue15")
        c.execute("create table issue15 (t varchar(32))")
        try:
            c.execute("insert into issue15 (t) values (%s)", ("\xe4\xf6\xfc",))
            c.execute("select t from issue15")
            self.assertEqual("\xe4\xf6\xfc", c.fetchone()[0])
        finally:
            c.execute("drop table issue15")
query should be expanded before perform character encoding
pymysql/tests/test_issues.py