Skip to content

Commit 8525c88

Browse files
Merge pull request julien-duponchelle#148 from baloo/fixup/parsing-of-gtid
gtid: fixup parsing on mysql format
2 parents e1f6c35 + 6ca8428 commit 8525c88

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pymysqlreplication/gtid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, gtid_set):
8585
if not gtid_set:
8686
self.gtids = []
8787
else:
88-
self.gtids = [Gtid(x) for x in gtid_set.split(',')]
88+
self.gtids = [Gtid(x.strip(' \n')) for x in gtid_set.split(',')]
8989

9090
def __str__(self):
9191
return ','.join(str(x) for x in self.gtids)

pymysqlreplication/tests/test_basic.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ def test_gtidset_representation(self):
705705
myset = GtidSet(set_repr)
706706
self.assertEqual(str(myset), set_repr)
707707

708+
def test_gtidset_representation_newline(self):
709+
set_repr = '57b70f4e-20d3-11e5-a393-4a63946f7eac:1-56,' \
710+
'4350f323-7565-4e59-8763-4b1b83a0ce0e:1-20'
711+
mysql_repr = '57b70f4e-20d3-11e5-a393-4a63946f7eac:1-56,\n' \
712+
'4350f323-7565-4e59-8763-4b1b83a0ce0e:1-20'
713+
714+
myset = GtidSet(mysql_repr)
715+
self.assertEqual(str(myset), set_repr)
716+
708717

709718
if __name__ == "__main__":
710719
import unittest

0 commit comments

Comments
 (0)