Skip to content

Commit e883427

Browse files
committed
fixed unittest.testcase to PyMySQLReplicationTestCase
1 parent 7435fcb commit e883427

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

pymysqlreplication/tests/test_util_bytes.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import unittest
21
from pymysqlreplication.util import *
2+
from pymysqlreplication.tests.base import PyMySQLReplicationTestCase
33

44

5-
class TestIsDataShort(unittest.TestCase):
5+
class TestIsDataShort(PyMySQLReplicationTestCase):
66
def test_data_is_shorter(self):
77
data = bytearray([0x01])
88
expected_length = 2
@@ -24,7 +24,7 @@ def test_data_is_empty(self):
2424
self.assertTrue(is_data_short(data, expected_length))
2525

2626

27-
class TestDecodeCount(unittest.TestCase):
27+
class TestDecodeCount(PyMySQLReplicationTestCase):
2828
def test_small_format(self):
2929
data = bytearray([0x01, 0x00])
3030
is_small = True
@@ -38,7 +38,7 @@ def test_large_format(self):
3838
self.assertEqual(result, 1)
3939

4040

41-
class TestDecodeUint(unittest.TestCase):
41+
class TestDecodeUint(PyMySQLReplicationTestCase):
4242
def test_valid_input(self):
4343
data = bytearray([0x01, 0x00])
4444
result = decode_uint(data)
@@ -55,7 +55,7 @@ def test_empty_data(self):
5555
self.assertEqual(result, 0)
5656

5757

58-
class TestDecodeVariableLength(unittest.TestCase):
58+
class TestDecodeVariableLength(PyMySQLReplicationTestCase):
5959
def test_single_byte(self):
6060
data = bytearray([0x05])
6161
length, pos = decode_variable_length(data)
@@ -75,7 +75,7 @@ def test_max_length(self):
7575
self.assertEqual(pos, 5)
7676

7777

78-
class TestParseUint16(unittest.TestCase):
78+
class TestParseUint16(PyMySQLReplicationTestCase):
7979
def test_valid_input(self):
8080
data = bytearray([0x01, 0x00])
8181
result = parse_uint16(data)
@@ -87,7 +87,7 @@ def test_different_input(self):
8787
self.assertEqual(result, 255)
8888

8989

90-
class TestLengthEncodedInt(unittest.TestCase):
90+
class TestLengthEncodedInt(PyMySQLReplicationTestCase):
9191
def test_single_byte(self):
9292
data = bytearray([0x05])
9393
result, _, _ = length_encoded_int(data)
@@ -104,7 +104,7 @@ def test_three_bytes(self):
104104
self.assertEqual(result, 0x030201)
105105

106106

107-
class TestDecodeTime(unittest.TestCase):
107+
class TestDecodeTime(PyMySQLReplicationTestCase):
108108
def test_midnight(self):
109109
data = bytearray([0x00] * 8)
110110
result = decode_time(data)
@@ -116,7 +116,7 @@ def test_valid_time(self):
116116
self.assertEqual(result, datetime.time(17, 35, 0))
117117

118118

119-
class TestDecodeDatetime(unittest.TestCase):
119+
class TestDecodeDatetime(PyMySQLReplicationTestCase):
120120
def test_zero_datetime(self):
121121
data = bytearray([0x00] * 8)
122122
result = decode_datetime(data)
@@ -129,7 +129,3 @@ def test_valid_datetime(self):
129129
)
130130
result = decode_datetime(data)
131131
self.assertEqual(result, expected_datetime)
132-
133-
134-
if __name__ == "__main__":
135-
unittest.main()

0 commit comments

Comments
 (0)