def test_unicode_iter(p): ctx = noop_manager() if is_exception(p.expected): ctx = raises(p.expected) with ctx: actual = list(unicode_iter(p.input)) if not is_exception(p.expected): assert p.expected == actual
def assert_writer_events(p, new_writer): buf, buf_writer = new_writer() ctx = noop_manager() if is_exception(p.expected): ctx = raises(p.expected) result_type = None with ctx: for event in p.events: result_type = buf_writer.send(event) if not is_exception(p.expected): assert result_type is WriteEventType.COMPLETE assert p.expected == buf.getvalue()