Skip to content

Commit 3b2441a

Browse files
Merge pull request #126 from romuald/gtiset-str
Fix GtidSet __str__ representation
2 parents d6ea96f + 4d5b3ec commit 3b2441a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pymysqlreplication/gtid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, gtid_set):
8888
self.gtids = [Gtid(x) for x in gtid_set.split(',')]
8989

9090
def __str__(self):
91-
return ','.join(repr(x) for x in self.gtids)
91+
return ','.join(str(x) for x in self.gtids)
9292

9393
def __repr__(self):
9494
return '<GtidSet "%s"' % ','.join(repr(x) for x in self.gtids)

pymysqlreplication/tests/test_basic.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from pymysqlreplication.tests import base
1010
from pymysqlreplication import BinLogStreamReader
11+
from pymysqlreplication.gtid import GtidSet
1112
from pymysqlreplication.event import *
1213
from pymysqlreplication.constants.BINLOG import *
1314
from pymysqlreplication.row_event import *
@@ -696,6 +697,15 @@ def test_position_gtid(self):
696697
self.assertEqual(event.query, 'CREATE TABLE test2 (id INT NOT NULL, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))');
697698

698699

700+
class TestGtidRepresentation(unittest.TestCase):
701+
def test_gtidset_representation(self):
702+
set_repr = '57b70f4e-20d3-11e5-a393-4a63946f7eac:1-56,' \
703+
'4350f323-7565-4e59-8763-4b1b83a0ce0e:1-20'
704+
705+
myset = GtidSet(set_repr)
706+
self.assertEqual(str(myset), set_repr)
707+
708+
699709
if __name__ == "__main__":
700710
import unittest
701711
unittest.main()

0 commit comments

Comments
 (0)