summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-08-05 23:42:08 +0200
committerMarcus Müller <marcus@hostalia.de>2018-08-17 18:18:20 +0200
commitf0f838e3f0484c6156bf20164af1bfa7ff150587 (patch)
tree6d42d1c55d7e5428cd143cb800f9310f73a59b9f /gr-blocks/python
parent2727e413a26024b17e649bc370afc45503173af6 (diff)
message: fix unit tests to respect mesage::to_string behaviour
Formerly to_string() returned a byte string in Python2 and a unicode string in Python3. To get the same behaviour for Python2 and Python3 the Unicode String in Python3 is converted to bytes. Which is a desired behaviour for to_string() since the carried payload of messages includes invalid unicode characters.
Diffstat (limited to 'gr-blocks/python')
-rw-r--r--gr-blocks/python/blocks/qa_message.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gr-blocks/python/blocks/qa_message.py b/gr-blocks/python/blocks/qa_message.py
index 639001f09a..1a3d250ab3 100644
--- a/gr-blocks/python/blocks/qa_message.py
+++ b/gr-blocks/python/blocks/qa_message.py
@@ -58,8 +58,8 @@ class test_message(gr_unittest.TestCase):
self.assertEquals(0, msg.length())
def test_101(self):
- s = 'This is a test'
- msg = gr.message_from_string(s)
+ s = b'This is a test'
+ msg = gr.message_from_string(s.decode('utf8'))
self.assertEquals(s, msg.to_string())
def test_200(self):