Skip to content

Commit a27e521

Browse files
committed
Failing test for write_int and write_short
1 parent b4bdd8e commit a27e521

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_util.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ def test_write_int_string(self):
1616
'\x00\x00\x00\x0bsome string'
1717
)
1818

19+
def test_write_int_string__unicode(self):
20+
with self.assertRaises(TypeError) as cm:
21+
kafka.util.write_int_string(u'unicode')
22+
#: :type: TypeError
23+
te = cm.exception
24+
self.assertIn('unicode', te.message)
25+
self.assertIn('to be str', te.message)
26+
1927
def test_write_int_string__empty(self):
2028
self.assertEqual(
2129
kafka.util.write_int_string(''),
@@ -43,6 +51,14 @@ def test_write_short_string(self):
4351
'\x00\x0bsome string'
4452
)
4553

54+
def test_write_short_string__unicode(self):
55+
with self.assertRaises(TypeError) as cm:
56+
kafka.util.write_short_string(u'hello')
57+
#: :type: TypeError
58+
te = cm.exception
59+
self.assertIn('unicode', te.message)
60+
self.assertIn('to be str', te.message)
61+
4662
def test_write_short_string__empty(self):
4763
self.assertEqual(
4864
kafka.util.write_short_string(''),

0 commit comments

Comments
 (0)