diff options
Diffstat (limited to 'test/test_util.py')
-rw-r--r-- | test/test_util.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_util.py b/test/test_util.py index 3f6e2f1..7b5f294 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -16,6 +16,14 @@ class UtilTest(unittest2.TestCase): '\x00\x00\x00\x0bsome string' ) + def test_write_int_string__unicode(self): + with self.assertRaises(TypeError) as cm: + kafka.util.write_int_string(u'unicode') + #: :type: TypeError + te = cm.exception + self.assertIn('unicode', te.message) + self.assertIn('to be str', te.message) + def test_write_int_string__empty(self): self.assertEqual( kafka.util.write_int_string(''), @@ -43,6 +51,14 @@ class UtilTest(unittest2.TestCase): '\x00\x0bsome string' ) + def test_write_short_string__unicode(self): + with self.assertRaises(TypeError) as cm: + kafka.util.write_short_string(u'hello') + #: :type: TypeError + te = cm.exception + self.assertIn('unicode', te.message) + self.assertIn('to be str', te.message) + def test_write_short_string__empty(self): self.assertEqual( kafka.util.write_short_string(''), |