from BasicGeometry.polygon import Polygon


class TestPolygon(unittest.TestCase):
    def setUp(self):
        pass

    def test_polygon1(self):
        polygon = Polygon()
        polygon.add_vertex(1, 1)
        polygon.add_vertex(1, 2)
        polygon.add_vertex(2, 3)
        polygon.add_vertex(3, 2.6)
        polygon.add_vertex(2.5, 0)

        self.assertTrue(polygon.contains(1.5, 1.5))
        self.assertFalse(polygon.contains(0, 1.5))
        self.assertFalse(polygon.contains(1.6, 3.1))

    def test_polygon2(self):
        polygon = Polygon()
        polygon.add_vertex(1, 1)
        polygon.add_vertex(1, 2)
        polygon.add_vertex(1.5, 1.5)
        polygon.add_vertex(3, 2.6)
        polygon.add_vertex(2.5, 0)

        self.assertFalse(polygon.contains(1.5, 1.6))
        self.assertFalse(polygon.contains(0, 1.5))
        self.assertTrue(polygon.contains(1.3, 1.7))


@@ -15,16 +15,8 @@
 etry
-.polygon
  imp
@@ -33,306 +33,173 @@
 n%0A%0A%0A
-class TestPolygon(unittest.TestCase):%0A    def setUp(self):%0A        pass%0A%0A    def test_polygon1(self):%0A        polygon = Polygon()%0A        polygon.add_vertex(1, 1)%0A        polygon.add_vertex(1, 2)%0A        polygon.add_vertex(2, 3)%0A        polygon.add_vertex(3, 2.6)%0A        polygon.add_vertex
+def test_initialize():%0A    polygon = Polygon(%5B(1, 1), (1, 2), (2, 3), (3, 2.6), (2.5, 0)%5D)%0A    assert polygon.vertices == %5B(1, 1), (1, 2), (2, 3), (3, 2.6), 
 (2.5, 0)
 %0A%0A  
@@ -198,204 +198,223 @@
 , 0)
+%5D
 %0A%0A
-        self.assertTrue(polygon.contains(1.5, 1.5))%0A        self.assertFalse(polygon.contains(0, 1.5
+def test_translate():%0A    polygon = Polygon(%5B(1, 1), (1, 2), (2, 3)%5D)%0A    polygon_tranlated = polygon.translate((2, 2
 ))%0A    
-    self.assertFalse(polygon.contains(1.6, 3.1))%0A%0A    def test_polygon2(self
+assert polygon_tranlated.vertices == %5B(3, 3), (3, 4), (4, 5)%5D%0A%0Adef test_contains(
 ):%0A    
-    
 poly
@@ -429,28 +429,24 @@
 lygon()%0A    
-    
 polygon.add_
@@ -456,22 +456,20 @@
 tex(
+(
 1, 1)
+)
 %0A
- 
     
-   
 poly
@@ -487,18 +487,16 @@
 tex(
+(
 1, 2)
+)
 %0A
-    
     
@@ -518,22 +518,16 @@
 tex(
-1.5, 1.5)%0A    
+(2, 3))%0A
     
@@ -549,24 +549,22 @@
 tex(
+(
 3, 2.6)
+)
 %0A
-  
     
-  
 poly
@@ -582,42 +582,29 @@
 tex(
+(
 2.5, 0)
-%0A
+)
 %0A    
-    self.assertFalse(
+assert 
 poly
@@ -620,44 +620,36 @@
 ins(
+(
 1.5, 1.
-6
+5
 ))%0A    
-    self.assertFalse(
+assert (not 
 poly
@@ -665,16 +665,17 @@
 ins(
+(
 0, 1.5))
 %0A   
@@ -674,33 +674,26 @@
 .5))
+)
 %0A    
-    self.assertTrue(
+assert (not 
 poly
@@ -709,16 +709,17 @@
 ins(
+(
 1.
-3, 1.7))%0A
+6, 3.1)))
 %0A

update polygon test