コード例 #1
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_Point__eq__(self):
     assert rect.SDL_Point() == rect.SDL_Point()
     coords = [(0, 0), (10, 0), (0, 10), (12, 10), (7, 10)]
     for x1, y1 in coords:
         for x2, y2 in coords:
             equal = rect.SDL_FPoint(x1, y1) == rect.SDL_FPoint(x2, y2)
             assert equal if (x1 == x2 and y1 == y2) else not equal
コード例 #2
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_FPoint__ne__(self):
     assert not rect.SDL_FPoint() != rect.SDL_FPoint()
     coords = [(0, 0.5), (10, 0.5), (0, 10.5), (12, 10.5), (7, 10.5)]
     for x1, y1 in coords:
         for x2, y2 in coords:
             notequal = rect.SDL_FPoint(x1, y1) != rect.SDL_FPoint(x2, y2)
             assert notequal if (x1 != x2 or y1 != y2) else not notequal
コード例 #3
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_FPoint(self):
     pt = rect.SDL_FPoint()
     assert (pt.x, pt.y) == (0, 0)
     for i in range(0, 100):
         x = random.uniform(-1000, 1000)
         y = random.uniform(-1000, 1000)
         pt = rect.SDL_FPoint(x, y)
         assert (pt.x, pt.y) == pytest.approx((x, y))
コード例 #4
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_FPoint__copy__(self):
     pt = rect.SDL_FPoint()
     pt2 = copy.copy(pt)
     assert pt == pt2
     assert (pt.x, pt.y) == (pt2.x, pt2.y)
     pt2.x = 7
     pt2.y = 9
     pt3 = copy.copy(pt2)
     assert pt != pt2
     assert pt3 == pt2
コード例 #5
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_FPoint_xy(self):
     pt = rect.SDL_FPoint()
     for i in range(0, 50):
         x = random.uniform(-1000, 1000)
         y = random.uniform(-1000, 1000)
         pt.x = x
         pt.y = y
         assert (pt.x, pt.y) == pytest.approx((x, y))
     with pytest.raises(TypeError):
         pt.x = "point"
     with pytest.raises(TypeError):
         pt.y = "point"
     with pytest.raises(TypeError):
         pt.x = None
     with pytest.raises(TypeError):
         pt.y = None
コード例 #6
0
ファイル: rect_test.py プロジェクト: Kebirs/Work_hours_app
 def test_SDL_FPoint__repr__(self):
     pt = rect.SDL_FPoint(3.24, 12.8)
     pt2 = eval("rect.%s" % repr(pt))
     assert pt == pt2
     assert (pt.x, pt.y) == (pt2.x, pt2.y)