Пример #1
0
def test_complex_region_manual_explicit():
    """Based on #1245.

    Here we create the region like test_complex_region_file_explicit
    """

    rmanual = Region(COMPLEX_REGION[0] + COMPLEX_REGION[2])
    rmanual = rmanual.union(Region(COMPLEX_REGION[1] + COMPLEX_REGION[2]))

    assert str(
        rmanual
    ) == 'Circle(50,50,30)&!RotBox(30,30,10,5,45)|Ellipse(40,75,30,20,320)&!RotBox(30,30,10,5,45)'
    check_complex_region_1245(rmanual)
Пример #2
0
def test_region_combine_combined():
    """Check multiple calls to union regions"""

    r1 = 'circle(10,10,10)'
    r2 = 'rect(100,100,200,200)'
    r3 = 'ellipse(70,70,10,12,45)'

    rcomb = Region(r1).union(Region(r2))
    rcomb = rcomb.union(Region(r3))

    r2 = r2.replace('rect', 'rectangle')
    expected = '|'.join([x.capitalize() for x in [r1, r2, r3]])
    assert expected == str(rcomb)
Пример #3
0
def test_complex_region_manual_implicit():
    """Based on #1245.

    Here we create the region like test_complex_region_file_implicit
    """

    rmanual = Region(COMPLEX_REGION[0])
    rmanual = rmanual.union(Region(COMPLEX_REGION[1]))
    rmanual = rmanual.subtract(Region(COMPLEX_REGION[2][1:]))

    # Note how the rotbox is only applied to the first shape (which it overlaps), not
    # the second one.
    assert str(
        rmanual
    ) == 'Circle(50,50,30)&!RotBox(30,30,10,5,45)|Ellipse(40,75,30,20,320)'
    check_complex_region_1245(rmanual)
Пример #4
0
def test_region_ignore_combined():
    """Check multiple calls to union/subtract

    I am not sure I agree with the result but I just want
    to check the results.
    """

    # Note r2 does not overlap r1
    r1 = 'circle(10,10,10)'
    r2 = 'rect(100,100,200,200)'
    r3 = 'ellipse(70,70,10,12,45)'

    rcomb = Region(r1).subtract(Region(r2))
    rcomb = rcomb.union(Region(r3))

    expected = '|'.join([r1.capitalize(), r3.capitalize()])
    assert expected == str(rcomb)