Skip to content

Commit b762bc9

Browse files
Copilotmethane
andauthored
Revert "Move set_charset warning test to dedicated deprecations module"
This reverts commit 9200bcf. Co-authored-by: methane <199592+methane@users.noreply.github.com>
1 parent 9200bcf commit b762bc9

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

pymysql/tests/test_deprecations.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

pymysql/tests/test_err.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import pytest
2+
from unittest import mock
23

34
from pymysql import err
5+
from pymysql.connections import Connection
46

57

68
def test_error_init_sqlstate():
@@ -27,3 +29,13 @@ def test_raise_mysql_exception():
2729
assert cm.type == err.OperationalError
2830
assert cm.value.args == (1040, "Too many connections")
2931
assert cm.value.sqlstate is None
32+
33+
34+
def test_set_charset_deprecated():
35+
con = mock.Mock(spec=Connection)
36+
with pytest.warns(
37+
DeprecationWarning,
38+
match="'set_charset' is deprecated, use 'set_character_set' instead",
39+
):
40+
Connection.set_charset(con, "utf8mb4")
41+
con.set_character_set.assert_called_once_with("utf8mb4")

0 commit comments

Comments
 (0)