Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
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()