@@ -33,13 +33,13 @@ class TestPoint:
3333 def test_accessors (self , cpp , C , x , y ):
3434 cpt = C .point (x , y )
3535 ppt = py_point (x , y )
36- assert abs ( cpt .x - ppt .x ) < 1e-10
37- assert abs ( cpt .y - ppt .y ) < 1e-10
36+ assert cpt .x == ppt .x
37+ assert cpt .y == ppt .y
3838 assert cpt .is_empty () == ppt .is_empty
3939 assert cpt .is_simple () == ppt .is_simple
4040 assert cpt .is_valid () == ppt .is_valid
41- assert cpt .area () == pytest . approx ( ppt .area , abs = 1e-10 )
42- assert cpt .length () == pytest . approx ( ppt .length , abs = 1e-10 )
41+ assert cpt .area () == ppt .area
42+ assert cpt .length () == ppt .length
4343 assert cpt .has_z () == ppt .has_z
4444 assert cpt .geom_type () == ppt .geom_type
4545 assert cpt .type () == "Point"
@@ -59,7 +59,7 @@ def test_coords_xy(self, cpp, C):
5959 p = C .point (1.5 , - 2.5 )
6060 cs = list (p .coords ())
6161 assert len (cs ) == 1
62- assert abs ( cs [0 ][0 ] - 1.5 ) < 1e-10
62+ assert cs [0 ][0 ] == 1.5
6363 assert abs (cs [0 ][1 ] - (- 2.5 )) < 1e-10
6464 xs , ys = p .xy ()
6565 assert xs == [1.5 ] and ys == [- 2.5 ]
@@ -68,8 +68,8 @@ def test_coords_xy(self, cpp, C):
6868 def test_centroid (self , cpp , C , x , y ):
6969 cx , cy = cpp .centroid_point (C .point (x , y ))
7070 pc = py_point (x , y ).centroid
71- assert abs ( cx - pc .x ) < 1e-10
72- assert abs ( cy - pc .y ) < 1e-10
71+ assert cx == pc .x
72+ assert cy == pc .y
7373
7474 def test_buffer (self , cpp , C ):
7575 buf = C .point (0 , 0 ).buffer (10.0 )
@@ -129,8 +129,8 @@ def test_accessors(self, cpp, C):
129129 assert c_ls .is_empty () == p_ls .is_empty
130130 assert c_ls .is_simple () == p_ls .is_simple
131131 assert c_ls .is_valid () == p_ls .is_valid
132- assert c_ls .area () == pytest . approx ( p_ls .area , abs = 1e-10 )
133- assert c_ls .length () == pytest . approx ( p_ls .length , abs = 1e-8 )
132+ assert c_ls .area () == p_ls .area
133+ assert c_ls .length () == p_ls .length
134134 assert c_ls .bounds () == list (p_ls .bounds )
135135
136136 def test_is_closed_ring (self , cpp , C ):
@@ -145,16 +145,16 @@ def test_coords_xy(self, cpp, C):
145145 pts = [(1 ,2 ),(3 ,4 ),(5 ,6 )]
146146 c_ls = C .linestring (pts )
147147 for (cx , cy ), (px , py ) in zip (c_ls .coords (), pts ):
148- assert abs ( cx - px ) < 1e-10
149- assert abs ( cy - py ) < 1e-10
148+ assert cx == px
149+ assert cy == py
150150 xs , ys = c_ls .xy ()
151151 assert xs == [1. ,3. ,5. ] and ys == [2. ,4. ,6. ]
152152
153153 def test_centroid (self , cpp , C ):
154154 cx , cy = cpp .centroid_linestring (C .linestring ([(0 ,0 ),(10 ,0 ),(10 ,10 )]))
155155 pc = py_linestring ([(0 ,0 ),(10 ,0 ),(10 ,10 )]).centroid
156- assert abs ( cx - pc .x ) < 1e-8
157- assert abs ( cy - pc .y ) < 1e-8
156+ assert cx == pc .x
157+ assert cy == pc .y
158158
159159 def test_predicates (self , cpp , C ):
160160 ls1 = C .linestring ([(0 ,5 ),(10 ,5 )])
@@ -203,29 +203,29 @@ def test_accessors(self, cpp, C):
203203 assert cp .is_empty () == pp .is_empty
204204 assert cp .is_simple () == pp .is_simple
205205 assert cp .is_valid () == pp .is_valid
206- assert cp .area () == pytest . approx ( pp .area , abs = 1e-8 )
207- assert cp .length () == pytest . approx ( pp .length , abs = 1e-8 )
206+ assert cp .area () == pp .area
207+ assert cp .length () == pp .length
208208 assert cp .bounds () == list (pp .bounds )
209209
210210 def test_centroid (self , cpp , C ):
211211 for coords in [self .SQ , [(0 ,0 ),(10 ,0 ),(5 ,8 )], [(0 ,0 ),(10 ,0 ),(10 ,5 ),(5 ,10 ),(0 ,5 )]]:
212212 cx , cy = cpp .centroid_polygon (C .polygon (coords ))
213213 pc = py_polygon (coords ).centroid
214- assert abs ( cx - pc .x ) < 1e-8
215- assert abs ( cy - pc .y ) < 1e-8
214+ assert cx == pc .x
215+ assert cy == pc .y
216216
217217 def test_exterior (self , cpp , C ):
218218 ext = cpp .polygon_exterior (C .polygon (self .SQ ))
219219 pext = py_polygon (self .SQ ).exterior
220220 assert ext .shape [0 ] == len (pext .coords )
221221 for i , (cpt , ppt ) in enumerate (zip (ext , pext .coords )):
222- assert abs ( cpt [0 ] - ppt [0 ]) < 1e-10
223- assert abs ( cpt [1 ] - ppt [1 ]) < 1e-10
222+ assert cpt [0 ] == ppt [0 ]
223+ assert cpt [1 ] == ppt [1 ]
224224
225225 def test_coords (self , cpp , C ):
226226 coords = list (C .polygon (self .SQ ).coords ())
227227 for (cx , cy ), (x , y ) in zip (coords , self .SQ ):
228- assert abs ( cx - x ) < 1e-10
228+ assert cx == x
229229
230230 def test_predicates_poly_poly (self , cpp , C ):
231231 sq = C .polygon (self .SQ )
@@ -293,9 +293,9 @@ def test_properties(self, cpp, C):
293293 assert cr .is_valid () == pr .is_valid
294294 assert cr .is_closed () == pr .is_closed
295295 assert cr .is_ring () == pr .is_ring
296- assert cr .length () == pytest . approx ( pr .length , abs = 1e-8 )
296+ assert cr .length () == pr .length
297297 assert cr .bounds () == list (pr .bounds )
298- assert cr .area () == pytest . approx ( pr .area , abs = 1e-10 )
298+ assert cr .area () == pr .area
299299
300300 def test_wkt (self , cpp , C ):
301301 assert_same_wkt (C .linearring (self .RING_SQ ).wkt (), py_linearring (self .RING_SQ ).wkt )
@@ -309,8 +309,8 @@ def test_geom_type(self, cpp, C):
309309 def test_coords_xy (self , cpp , C ):
310310 cr = C .linearring (self .RING_SQ )
311311 for (cx , cy ), (x , y ) in zip (cr .coords (), self .RING_SQ ):
312- assert abs ( cx - x ) < 1e-10
313- assert abs ( cy - y ) < 1e-10
312+ assert cx == x
313+ assert cy == y
314314 xs , ys = cr .xy ()
315315 assert len (xs ) == 4 and len (ys ) == 4
316316
0 commit comments