def test_escape_dict_raise_typeerror(self):
        """con.escape(dict) should raise TypeError"""
        con = self.connect()

        mapping = con.encoders.copy()
        mapping[Foo] = escape_foo
        # self.assertEqual(con.escape({"foo": Foo()}, mapping), {"foo": "bar"})
        with self.assertRaises(TypeError):
            con.escape({"foo": Foo()})
con.escape(dict) should raise TypeError
pymysql/tests/test_connection.py