def test_translate_opacity(assert_same_renderings):
    # Regression test for https://github.com/Kozea/WeasyPrint/issues/1976
    assert_same_renderings(
        opacity_source % '''
            <rect transform="translate(2, 2)" width="5" height="5"
                  fill="blue" opacity="0.5" />
        ''',
        opacity_source % '''
            <rect x="2" y="2" width="5" height="5"
                  fill="blue" opacity="50%" />
        ''',
    )
,
opacity_source %
tests/draw/svg/test_opacity.py