Skip to content

Commit eff5596

Browse files
committed
feat: add version8 test in test_data_type.py
related PR: julien-duponchelle#355
1 parent ff58278 commit eff5596

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

pymysqlreplication/tests/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ def bin_log_basename(self):
161161
bin_log_basename = bin_log_basename.split("/")[-1]
162162
return bin_log_basename
163163

164+
164165
class PyMySQLReplicationPercona8TestCase(PyMySQLReplicationTestCase):
165166
def setUp(self):
166-
super().setUp()
167+
super().setUp()
167168
# default
168169
self.database = {
169170
"host": os.environ.get("MYSQL_8_0") or "localhost",

pymysqlreplication/tests/test_data_type.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pymysqlreplication._compat import text_type
2020

2121

22-
__all__ = ["TestDataType"]
22+
__all__ = ["TestDataType", "TestDataTypeVersion8"]
2323

2424

2525
def to_binary_dict(d):
@@ -894,5 +894,23 @@ def test_mariadb_only_status_vars(self):
894894
self.assertEqual(event.query, create_query)
895895

896896

897+
class TestDataTypeVersion8(base.PyMySQLReplicationPercona8TestCase):
898+
def test_partition_id(self):
899+
if not self.isMySQL80AndMore():
900+
self.skipTest("Not supported in this version of MySQL")
901+
create_query = "CREATE TABLE test (id INTEGER) \
902+
PARTITION BY RANGE (id) ( \
903+
PARTITION p0 VALUES LESS THAN (1), \
904+
PARTITION p1 VALUES LESS THAN (2), \
905+
PARTITION p2 VALUES LESS THAN (3), \
906+
PARTITION p3 VALUES LESS THAN (4), \
907+
PARTITION p4 VALUES LESS THAN (5) \
908+
)"
909+
insert_query = "INSERT INTO test (id) VALUES(3)"
910+
event = self.create_and_insert_value(create_query, insert_query)
911+
self.assertEqual(event.extra_data_type, 1)
912+
self.assertEqual(event.partition_id, 3)
913+
914+
897915
if __name__ == "__main__":
898916
unittest.main()

0 commit comments

Comments
 (0)