def test_rect_sub_wh(): r = Rect(w=1, h=2) s = Rect(w=3, h=4) q = r - s assert q.x == 0 and q.y == 0 and q.w == -2 and q.h == -2
def test_rect_truediv_empty(): r = Rect() s = Rect() with pytest.raises(ZeroDivisionError): _ = r / s
def test_rect_itruediv_empty_rect(): r = Rect(1, 2, 3, 4) s = Rect() with pytest.raises(ZeroDivisionError): r /= s
def test_rect_truediv_wh(): r = Rect(w=1, h=2) s = Rect(w=3, h=4) with pytest.raises(ZeroDivisionError): _ = r / s
def test_rect_truediv_empty_point(): p = Point() r = Rect(1, 2, 3, 4) with pytest.raises(ZeroDivisionError): _ = r / p
def test_rect_not_in_rect(): bb = Rect(0, 0, 1, 1) qq = Rect(10, 10, 1, 1) assert bb not in qq assert qq not in bb
def test_point_not_in_rect(): p = Point() bb = Rect(1, 1, 2, 2) assert p not in bb
def test_rect_mul_xy(): r = Rect(1, 2) s = Rect(3, 4) q = r * s assert q.x == 3 and q.y == 8 and q.w == 0 and q.h == 0
def test_rect_mul_wh(): r = Rect(w=1, h=2) s = Rect(w=3, h=4) q = r * s assert q.x == 0 and q.y == 0 and q.w == 3 and q.h == 8
def test_rect_isub_nonempty_point(): r = Rect(1, 2, 3, 4) p = Point(1, 2) r -= p assert r.x == 0 and r.y == 0 and r.w == 3 and r.h == 4
def test_rect_isub_empty_rect(): r = Rect(1, 2, 3, 4) s = Rect() r -= s assert r.x == 1 and r.y == 2 and r.w == 3 and r.h == 4
def test_rect_sub_nonempty_point(): r = Rect(1, 2, 3, 4) p = Point(2, 3) q = r - p assert q.x == -1 and q.y == -1 and q.w == 3 and q.h == 4
def test_rect_sub_empty_point(): p = Point() r = Rect(1, 2, 3, 4) q = r - p assert q.x == 1 and q.y == 2 and q.w == 3 and q.h == 4
def test_rect_sub_xywh(): r = Rect(1, 2, 3, 4) s = Rect(5, 6, 7, 8) q = r - s assert q.x == -4 and q.y == -4 and q.w == -4 and q.h == -4
def test_rect_in_rect(): bb = Rect(1, 1, 1, 1) qq = Rect(0, 0, 3, 3) assert bb in qq
def test_rect_mul_xywh(): r = Rect(1, 2, 3, 4) s = Rect(5, 6, 7, 8) q = r * s assert q.x == 5 and q.y == 12 and q.w == 21 and q.h == 32
def test_outer_rect_in_inner_rect(): bb = Rect(1, 1, 1, 1) qq = Rect(0, 0, 3, 3) assert qq in bb
def test_rect_mul_empty(): r = Rect() s = Rect() q = r * s assert q.x == 0 and q.y == 0 and q.w == 0 and q.h == 0 assert q == r and q == s and q is not r and q is not s
def test_point_in_rect(): bb = Rect(1, 1, 2, 2) assert bb.center in bb
def test_rect_mul_empty_point(): p = Point() r = Rect(1, 2, 3, 4) q = r * p assert q.x == 0 and q.y == 0 and q.w == 3 and q.h == 4
def test_rect_truediv_xy(): r = Rect(1, 2) s = Rect(3, 4) with pytest.raises(ZeroDivisionError): _ = r / s
def test_rect_mul_nonempty_point(): r = Rect(1, 2, 3, 4) p = Point(2, 3) q = r * p assert q.x == 2 and q.y == 6 and q.w == 3 and q.h == 4
def test_rect_truediv_xywh(): r = Rect(2, 4, 6, 8) s = Rect(2, 2, 2, 2) q = r / s assert q.x == 1 and q.y == 2 and q.w == 3 and q.h == 4
def test_rect_imul_nonempty_point(): r = Rect(1, 2, 3, 4) p = Point(1, 2) r *= p assert r.x == 1 and r.y == 4 and r.w == 3 and r.h == 4
def test_rect_truediv_nonempty_point(): r = Rect(2, 4, 6, 8) p = Point(2, 2) q = r / p assert q.x == 1 and q.y == 2 and q.w == 6 and q.h == 8
def test_rect_imul_empty_rect(): r = Rect(1, 2, 3, 4) s = Rect() r *= s assert r.x == 0 and r.y == 0 and r.w == 0 and r.h == 0
def test_rect_itruediv_nonempty_point(): r = Rect(2, 4, 6, 8) p = Point(2, 2) r /= p assert r.x == 1 and r.y == 2 and r.w == 6 and r.h == 8
def test_rect_ifloordiv_empty_point(): r = Rect(1, 2, 3, 4) p = Point() with pytest.raises(ZeroDivisionError): r //= p
def test_rect_itruediv_nonempty_rect(): r = Rect(2, 4, 6, 8) s = Rect(2, 2, 2, 2) r /= s assert r.x == 1 and r.y == 2 and r.w == 3 and r.h == 4
def test_rect_sub_xy(): r = Rect(1, 2) s = Rect(3, 4) q = r - s assert q.x == -2 and q.y == -2 and q.w == 0 and q.h == 0