def make_error_body(self, code, msg): buf = StringIO() write_int(buf, code) write_string(buf, msg) return buf.getvalue()
def test_write_read_string(self): with tempfile.TemporaryFile() as f: value = u'test' write_string(f, value) f.seek(0) self.assertEqual(read_string(f), value)