Commit c1243f5d authored by Alexander Dielen's avatar Alexander Dielen

fixes most of the python2 unit tests

parent 697be987
Pipeline #6120 failed with stage
in 1 minute and 35 seconds
...@@ -89,7 +89,6 @@ void expose_circulator(py::module& m, const char *_name) { ...@@ -89,7 +89,6 @@ void expose_circulator(py::module& m, const char *_name) {
.def(py::init<PolyMesh&, CenterEntityHandle>()) .def(py::init<PolyMesh&, CenterEntityHandle>())
.def("__iter__", &CirculatorWrapperT<Circulator, CenterEntityHandle>::iter) .def("__iter__", &CirculatorWrapperT<Circulator, CenterEntityHandle>::iter)
.def("__next__", &CirculatorWrapperT<Circulator, CenterEntityHandle>::next) .def("__next__", &CirculatorWrapperT<Circulator, CenterEntityHandle>::next)
.def("next", &CirculatorWrapperT<Circulator, CenterEntityHandle>::next)
; ;
} }
......
...@@ -114,7 +114,6 @@ void expose_iterator(py::module& m, const char *_name) { ...@@ -114,7 +114,6 @@ void expose_iterator(py::module& m, const char *_name) {
.def("__iter__", &IteratorWrapperT<Iterator, n_items>::iter) .def("__iter__", &IteratorWrapperT<Iterator, n_items>::iter)
.def("__next__", &IteratorWrapperT<Iterator, n_items>::next) .def("__next__", &IteratorWrapperT<Iterator, n_items>::next)
.def("__len__", &IteratorWrapperT<Iterator, n_items>::len) .def("__len__", &IteratorWrapperT<Iterator, n_items>::len)
.def("next", &IteratorWrapperT<Iterator, n_items>::next)
; ;
} }
......
...@@ -52,26 +52,26 @@ class Property(unittest.TestCase): ...@@ -52,26 +52,26 @@ class Property(unittest.TestCase):
# Check if property it is ok # Check if property it is ok
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 0) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 0)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 3)
# Check vertex positions # Check vertex positions
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
...@@ -79,52 +79,52 @@ class Property(unittest.TestCase): ...@@ -79,52 +79,52 @@ class Property(unittest.TestCase):
# Copy from vertex 1 to 0, with skipping build in properties # Copy from vertex 1 to 0, with skipping build in properties
self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0]) self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0])
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 3)
# Copy from vertex 2 to 3, including build in properties # Copy from vertex 2 to 3, including build in properties
self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True) self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
def test_check_status_properties_halfedge_edge_all_deleted(self): def test_check_status_properties_halfedge_edge_all_deleted(self):
self.mesh.request_vertex_status() self.mesh.request_vertex_status()
...@@ -212,26 +212,26 @@ class Property(unittest.TestCase): ...@@ -212,26 +212,26 @@ class Property(unittest.TestCase):
# Check if property it is ok # Check if property it is ok
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 0) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 0)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 3)
# Check vertex positions # Check vertex positions
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
...@@ -239,52 +239,52 @@ class Property(unittest.TestCase): ...@@ -239,52 +239,52 @@ class Property(unittest.TestCase):
# Copy from vertex 1 to 0, with skipping build in properties # Copy from vertex 1 to 0, with skipping build in properties
self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0]) self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0])
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 3)
# Copy from vertex 2 to 3, including build in properties # Copy from vertex 2 to 3, including build in properties
self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True) self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 0) self.assertEqual(self.mesh.point(vh)[1], 0)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 0) self.assertEqual(self.mesh.point(vh)[0], 0)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
vh = v_it.next() vh = next(v_it)
self.assertEqual(self.mesh.point(vh)[0], 1) self.assertEqual(self.mesh.point(vh)[0], 1)
self.assertEqual(self.mesh.point(vh)[1], 1) self.assertEqual(self.mesh.point(vh)[1], 1)
self.assertEqual(self.mesh.point(vh)[2], 0) self.assertEqual(self.mesh.point(vh)[2], 0)
v_it = self.mesh.vertices() v_it = self.mesh.vertices()
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 1)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) self.assertEqual(self.mesh.property(intHandle, next(v_it)), 2)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Property) suite = unittest.TestLoader().loadTestsFromTestCase(Property)
......
...@@ -41,10 +41,11 @@ class TriMeshCirculatorFaceEdge(unittest.TestCase): ...@@ -41,10 +41,11 @@ class TriMeshCirculatorFaceEdge(unittest.TestCase):
def test_face_edge_iter_without_holes_increment(self): def test_face_edge_iter_without_holes_increment(self):
# Iterate around face 1 at the middle # Iterate around face 1 at the middle
fe_it = openmesh.FaceEdgeIter(self.mesh, self.mesh.face_handle(1)) fe_it = openmesh.FaceEdgeIter(self.mesh, self.mesh.face_handle(1))
self.assertEqual(fe_it.__next__().idx(), 4) self.assertEqual(next(fe_it).idx(), 4)
self.assertEqual(fe_it.__next__().idx(), 1) self.assertEqual(next(fe_it).idx(), 1)
self.assertEqual(fe_it.__next__().idx(), 3) self.assertEqual(next(fe_it).idx(), 3)
self.assertRaises(StopIteration, fe_it.__next__) with self.assertRaises(StopIteration):
next(fe_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -49,9 +49,10 @@ class TrimeshCirculatorFaceFace(unittest.TestCase): ...@@ -49,9 +49,10 @@ class TrimeshCirculatorFaceFace(unittest.TestCase):
ff_it = self.mesh.ff(self.mesh.face_handle(1)) ff_it = self.mesh.ff(self.mesh.face_handle(1))
self.assertEqual(ff_it.__next__().idx(), 2) self.assertEqual(next(ff_it).idx(), 2)
self.assertEqual(ff_it.__next__().idx(), 0) self.assertEqual(next(ff_it).idx(), 0)
self.assertRaises(StopIteration, ff_it.__next__) with self.assertRaises(StopIteration):
next(ff_it)
def test_face_face_iter_without_holes(self): def test_face_face_iter_without_holes(self):
# Add some vertices # Add some vertices
...@@ -106,10 +107,11 @@ class TrimeshCirculatorFaceFace(unittest.TestCase): ...@@ -106,10 +107,11 @@ class TrimeshCirculatorFaceFace(unittest.TestCase):
ff_it = self.mesh.ff(self.mesh.face_handle(1)) ff_it = self.mesh.ff(self.mesh.face_handle(1))
self.assertEqual(ff_it.__next__().idx(), 2) self.assertEqual(next(ff_it).idx(), 2)
self.assertEqual(ff_it.__next__().idx(), 0) self.assertEqual(next(ff_it).idx(), 0)
self.assertEqual(ff_it.__next__().idx(), 3) self.assertEqual(next(ff_it).idx(), 3)
self.assertRaises(StopIteration, ff_it.__next__) with self.assertRaises(StopIteration):
next(ff_it)
def test_face_face_iter_without_holes(self): def test_face_face_iter_without_holes(self):
# Add some vertices # Add some vertices
...@@ -147,7 +149,7 @@ class TrimeshCirculatorFaceFace(unittest.TestCase): ...@@ -147,7 +149,7 @@ class TrimeshCirculatorFaceFace(unittest.TestCase):
face_iter = self.mesh.ff(fh1) face_iter = self.mesh.ff(fh1)
# Get the face via the handle # Get the face via the handle
faceHandle1 = face_iter.__next__() faceHandle1 = next(face_iter)
face1 = self.mesh.face(faceHandle1) face1 = self.mesh.face(faceHandle1)
self.assertEqual(faceHandle1.idx(), 1) self.assertEqual(faceHandle1.idx(), 1)
......
...@@ -41,10 +41,11 @@ class TriMeshCirculatorFaceHalfEdge(unittest.TestCase): ...@@ -41,10 +41,11 @@ class TriMeshCirculatorFaceHalfEdge(unittest.TestCase):
def test_face_halfedge_iter_without_holes_increment(self): def test_face_halfedge_iter_without_holes_increment(self):
# Iterate around face 1 at the middle # Iterate around face 1 at the middle
fh_it = openmesh.FaceHalfedgeIter(self.mesh, self.mesh.face_handle(1)) fh_it = openmesh.FaceHalfedgeIter(self.mesh, self.mesh.face_handle(1))
self.assertEqual(fh_it.__next__().idx(), 8) self.assertEqual(next(fh_it).idx(), 8)
self.assertEqual(fh_it.__next__().idx(), 3) self.assertEqual(next(fh_it).idx(), 3)
self.assertEqual(fh_it.__next__().idx(), 6) self.assertEqual(next(fh_it).idx(), 6)
self.assertRaises(StopIteration, fh_it.__next__) with self.assertRaises(StopIteration):
next(fh_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -39,10 +39,11 @@ class TriMeshCirculatorFaceVertex(unittest.TestCase): ...@@ -39,10 +39,11 @@ class TriMeshCirculatorFaceVertex(unittest.TestCase):
# Iterate around face 0 at the top # Iterate around face 0 at the top
fv_it = openmesh.FaceVertexIter(self.mesh, self.fh0) fv_it = openmesh.FaceVertexIter(self.mesh, self.fh0)
self.assertEqual(fv_it.__next__().idx(), 0) self.assertEqual(next(fv_it).idx(), 0)
self.assertEqual(fv_it.__next__().idx(), 1) self.assertEqual(next(fv_it).idx(), 1)
self.assertEqual(fv_it.__next__().idx(), 2) self.assertEqual(next(fv_it).idx(), 2)
self.assertRaises(StopIteration, fv_it.__next__) with self.assertRaises(StopIteration):
next(fv_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -66,10 +66,11 @@ class TrimeshCirculatorHalfedgeLoop(unittest.TestCase): ...@@ -66,10 +66,11 @@ class TrimeshCirculatorHalfedgeLoop(unittest.TestCase):
# Circle around face 1 # Circle around face 1
hl_it = self.mesh.hl(self.mesh.halfedge_handle(3)) hl_it = self.mesh.hl(self.mesh.halfedge_handle(3))
self.assertEqual(hl_it.__next__().idx(), 3) self.assertEqual(next(hl_it).idx(), 3)
self.assertEqual(hl_it.__next__().idx(), 6) self.assertEqual(next(hl_it).idx(), 6)
self.assertEqual(hl_it.__next__().idx(), 8) self.assertEqual(next(hl_it).idx(), 8)
self.assertRaises(StopIteration, hl_it.__next__) with self.assertRaises(StopIteration):
next(hl_it)
def test_halfedge_loop_without_face(self): def test_halfedge_loop_without_face(self):
# Add some vertices # Add some vertices
...@@ -122,10 +123,11 @@ class TrimeshCirculatorHalfedgeLoop(unittest.TestCase): ...@@ -122,10 +123,11 @@ class TrimeshCirculatorHalfedgeLoop(unittest.TestCase):
# Circle around the hole # Circle around the hole
hl_it = self.mesh.hl(self.mesh.halfedge_handle(3)) hl_it = self.mesh.hl(self.mesh.halfedge_handle(3))
self.assertEqual(hl_it.__next__().idx(), 3) self.assertEqual(next(hl_it).idx(), 3)
self.assertEqual(hl_it.__next__().idx(), 17) self.assertEqual(next(hl_it).idx(), 17)
self.assertEqual(hl_it.__next__().idx(), 7) self.assertEqual(next(hl_it).idx(), 7)
self.assertRaises(StopIteration, hl_it.__next__) with self.assertRaises(StopIteration):
next(hl_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -37,19 +37,21 @@ class TriMeshCirculatorVertexEdge(unittest.TestCase): ...@@ -37,19 +37,21 @@ class TriMeshCirculatorVertexEdge(unittest.TestCase):
def test_vertex_edge_iter_without_holes_increment(self): def test_vertex_edge_iter_without_holes_increment(self):
# Iterate around vertex 1 at the middle # Iterate around vertex 1 at the middle
ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[1]) ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[1])
self.assertEqual(ve_it.__next__().idx(), 5) self.assertEqual(next(ve_it).idx(), 5)
self.assertEqual(ve_it.__next__().idx(), 3) self.assertEqual(next(ve_it).idx(), 3)
self.assertEqual(ve_it.__next__().idx(), 0) self.assertEqual(next(ve_it).idx(), 0)
self.assertEqual(ve_it.__next__().idx(), 1) self.assertEqual(next(ve_it).idx(), 1)
self.assertRaises(StopIteration, ve_it.__next__) with self.assertRaises(StopIteration):
next(ve_it)
def test_vertex_edge_iter_boundary_increment(self): def test_vertex_edge_iter_boundary_increment(self):
# Iterate around vertex 2 at the boundary # Iterate around vertex 2 at the boundary
ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[2]) ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[2])
self.assertEqual(ve_it.__next__().idx(), 7) self.assertEqual(next(ve_it).idx(), 7)
self.assertEqual(ve_it.__next__().idx(), 1) self.assertEqual(next(ve_it).idx(), 1)
self.assertEqual(ve_it.__next__().idx(), 2) self.assertEqual(next(ve_it).idx(), 2)
self.assertRaises(StopIteration, ve_it.__next__) with self.assertRaises(StopIteration):
next(ve_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -35,9 +35,10 @@ class TriMeshCirculatorVertexFace(unittest.TestCase): ...@@ -35,9 +35,10 @@ class TriMeshCirculatorVertexFace(unittest.TestCase):
# Iterate around vertex 1 at the middle (with holes in between) # Iterate around vertex 1 at the middle (with holes in between)
vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1]) vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1])
self.assertEqual(vf_it.__next__().idx(), 0) self.assertEqual(next(vf_it).idx(), 0)
self.assertEqual(vf_it.__next__().idx(), 1) self.assertEqual(next(vf_it).idx(), 1)
self.assertRaises(StopIteration, vf_it.__next__) with self.assertRaises(StopIteration):
next(vf_it)
def test_vertex_face_iter_without_holes_increment(self): def test_vertex_face_iter_without_holes_increment(self):
# Add four faces # Add four faces
...@@ -59,11 +60,12 @@ class TriMeshCirculatorVertexFace(unittest.TestCase): ...@@ -59,11 +60,12 @@ class TriMeshCirculatorVertexFace(unittest.TestCase):
# Iterate around vertex 1 at the middle (without holes in between) # Iterate around vertex 1 at the middle (without holes in between)
vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1]) vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1])
self.assertEqual(vf_it.__next__().idx(), 3) self.assertEqual(next(vf_it).idx(), 3)
self.assertEqual(vf_it.__next__().idx(), 1) self.assertEqual(next(vf_it).idx(), 1)
self.assertEqual(vf_it.__next__().idx(), 2) self.assertEqual(next(vf_it).idx(), 2)
self.assertEqual(vf_it.__next__().idx(), 0) self.assertEqual(next(vf_it).idx(), 0)
self.assertRaises(StopIteration, vf_it.__next__) with self.assertRaises(StopIteration):
next(vf_it)
def test_vertex_face_iter_boundary_increment(self): def test_vertex_face_iter_boundary_increment(self):
# Add four faces # Add four faces
...@@ -85,9 +87,10 @@ class TriMeshCirculatorVertexFace(unittest.TestCase): ...@@ -85,9 +87,10 @@ class TriMeshCirculatorVertexFace(unittest.TestCase):
# Iterate around vertex 2 at the boundary (without holes in between) # Iterate around vertex 2 at the boundary (without holes in between)
vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[2]) vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[2])
self.assertEqual(vf_it.__next__().idx(), 3) self.assertEqual(next(vf_it).idx(), 3)
self.assertEqual(vf_it.__next__().idx(), 0) self.assertEqual(next(vf_it).idx(), 0)
self.assertRaises(StopIteration, vf_it.__next__) with self.assertRaises(StopIteration):
next(vf_it)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -38,38 +38,40 @@ class TriMeshCirculatorVertexIHalfEdge(unittest.TestCase): ...@@ -38,38 +38,40 @@ class TriMeshCirculatorVertexIHalfEdge(unittest.TestCase):
def test_vertex_incoming_halfedge_without_holes_increment(self): def test_vertex_incoming_halfedge_without_holes_increment(self):
# Iterate around vertex 1 at the middle # Iterate around vertex 1 at the middle