From d361d68867e14c8905e2fb1290c7e78bf73ba429 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Wed, 5 Oct 2016 03:37:47 +0200 Subject: test_util: compatibility with Python 3.x < 3.4 --- test/test_util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_util.py b/test/test_util.py index 664340f..1eba962 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -21,7 +21,9 @@ class Test_util(unittest.TestCase): self.assertEqual(serial.to_bytes([1, 2, 3]), b'\x01\x02\x03') self.assertEqual(serial.to_bytes(b'\x01\x02\x03'), b'\x01\x02\x03') self.assertEqual(serial.to_bytes(bytearray([1,2,3])), b'\x01\x02\x03') - self.assertRaises(TypeError, serial.to_bytes, u'hello') + # unicode is not supported test. use decode() instead of u'' syntax to be + # compatible to Python 3.x < 3.4 + self.assertRaises(TypeError, serial.to_bytes, b'hello'.decode('utf-8')) def test_iterbytes(self): self.assertEqual(list(serial.iterbytes(b'\x01\x02\x03')), [b'\x01', b'\x02', b'\x03']) -- cgit v1.2.1