# Path: tests/testing_utils.py
# def assert_no_logs(function):
#     """Decorator that asserts that nothing is logged in a function."""
#     @functools.wraps(function)
#     def wrapper(*args, **kwargs):
#         with capture_logs() as logs:
#             try:
#                 function(*args, **kwargs)
#             except Exception:  # pragma: no cover
#                 if logs:
#                     print(f'{len(logs)} errors logged:', file=sys.stderr)
#                     for message in logs:
#                         print(message, file=sys.stderr)
#                 raise
#             else:
#                 if logs:  # pragma: no cover
#                     for message in logs:
#                         print(message, file=sys.stderr)
#                     raise AssertionError(f'{len(logs)} errors logged')
#     return wrapper
# 
# def render_pages(html_content):
#     """Lay out a document and return a list of PageBox objects."""
#     return [
#         page._page_box for page in
#         FakeHTML(string=html_content, base_url=BASE_URL).render().pages]


from ..testing_utils import assert_no_logs, render_pages
        <img src=pattern.png
             style="position: relative; left: -5px; top: 5px">
        <img src=pattern.png>
        <img src=pattern.png
             style="position: relative; right: 5px; bottom: 5px">
        <img src=pattern.png style="position: relative">
        <img src=pattern.png>
      </span>
      <span><img src=pattern.png></span>
    ''')
    html, = page.children
    body, = html.children
    line, = body.children
    span1, span2, span3 = line.children
    img1, = span1.children
    img2, img3, img4, img5, img6, img7 = span2.children
    img8, = span3.children
    assert (img1.position_x, img1.position_y) == (0, 0)
    # Don't test the span2.position_y because it depends on fonts
    assert span2.position_x == 30
    assert (img2.position_x, img2.position_y) == (30, 0)
    assert (img3.position_x, img3.position_y) == (45, 5)  # (50 - 5, y + 5)
    assert (img4.position_x, img4.position_y) == (70, 0)
    assert (img5.position_x, img5.position_y) == (85, -5)  # (90 - 5, y - 5)
    assert (img6.position_x, img6.position_y) == (110, 0)
    assert (img7.position_x, img7.position_y) == (130, 0)
    assert (img8.position_x, img8.position_y) == (140, 0)
    assert span2.width == 120



# Path: tests/testing_utils.py
# def assert_no_logs(function):
#     """Decorator that asserts that nothing is logged in a function."""
#     @functools.wraps(function)
#     def wrapper(*args, **kwargs):
#         with capture_logs() as logs:
#             try:
#                 function(*args, **kwargs)
#             except Exception:  # pragma: no cover
#                 if logs:
#                     print(f'{len(logs)} errors logged:', file=sys.stderr)
#                     for message in logs:
#                         print(message, file=sys.stderr)
#                 raise
#             else:
#                 if logs:  # pragma: no cover
#                     for message in logs:
#                         print(message, file=sys.stderr)
#                     raise AssertionError(f'{len(logs)} errors logged')
#     return wrapper
# 
# def render_pages(html_content):
#     """Lay out a document and return a list of PageBox objects."""
#     return [
#         page._page_box for page in
#         FakeHTML(string=html_content, base_url=BASE_URL).render().pages]


# Path: tests/layout/test_position.py
from ..testing_utils import assert_no_logs, render_pages

        <img src=pattern.png
             style="position: relative; left: -5px; top: 5px">
        <img src=pattern.png>
        <img src=pattern.png
             style="position: relative; right: 5px; bottom: 5px">
        <img src=pattern.png style="position: relative">
        <img src=pattern.png>
      </span>
      <span><img src=pattern.png></span>
    ''')
    html, = page.children
    body, = html.children
    line, = body.children
    span1, span2, span3 = line.children
    img1, = span1.children
    img2, img3, img4, img5, img6, img7 = span2.children
    img8, = span3.children
    assert (img1.position_x, img1.position_y) == (0, 0)
    # Don't test the span2.position_y because it depends on fonts
    assert span2.position_x == 30
    assert (img2.position_x, img2.position_y) == (30, 0)
    assert (img3.position_x, img3.position_y) == (45, 5)  # (50 - 5, y + 5)
    assert (img4.position_x, img4.position_y) == (70, 0)
    assert (img5.position_x, img5.position_y) == (85, -5)  # (90 - 5, y - 5)
    assert (img6.position_x, img6.position_y) == (110, 0)
    assert (img7.position_x, img7.position_y) == (130, 0)
    assert (img8.position_x, img8.position_y) == (140, 0)
    assert span2.width == 120



@assert_no_logs