Skip to content

Commit

Permalink
Added pragmas to skip coverage for certain lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeard4 committed Mar 3, 2020
1 parent 81f8176 commit 1162bfe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions hobart/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
from ._internal import EdgeMap, Graph
from ._validation import check_indices

__all__ = [
"faces_intersecting_plane",
"intersect_mesh_with_plane",
]
__all__ = ["faces_intersecting_plane", "intersect_mesh_with_plane"]


def faces_intersecting_plane(vertices, faces, plane):
Expand Down Expand Up @@ -117,15 +114,15 @@ def intersect_mesh_with_plane(
elif e1 is None:
G.add_edge(e0, e2)
else:
G.add_edge(e0, e1)
G.add_edge(e0, e1) # pragma: no cover

# 4: Find the paths for each component
components = []
components_closed = []
while len(G) > 0:
path = G.pop_euler_path()
if path is None:
raise ValueError(
raise ValueError( # pragma: no cover
"Mesh slice has too many odd degree edges; can't find a path along the edge"
)
component_verts = verts[path]
Expand All @@ -152,10 +149,12 @@ def intersect_mesh_with_plane(
else:
return Polyline(components[index], is_closed=components_closed[index])
elif neighborhood is not None and len(components) == 1:
if ret_pointcloud:
return components[0]
if ret_pointcloud: # pragma: no cover
return components[0] # pragma: no cover
else:
return Polyline(components[0], is_closed=components_closed[0])
return Polyline(
components[0], is_closed=components_closed[0]
) # pragma: no cover
else:
# No neighborhood provided, so return all the components, either in a
# pointcloud or as separate polylines.
Expand Down
4 changes: 2 additions & 2 deletions hobart/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def remove_edge(self, u, v):
if u in self.d and v in self.d[u]:
self.d[u].remove(v)
if v in self.d and u in self.d[v]:
self.d[v].remove(u)
self.d[v].remove(u) # pragma: no cover
if v in self.d and len(self.d[v]) == 0:
del self.d[v]
if u in self.d and len(self.d[u]) == 0:
Expand All @@ -79,7 +79,7 @@ def pop_euler_path(self, allow_multiple_connected_components=True):
odd = [x for x in self.d if len(self.d[x]) & 1]
odd.append(list(self.d.keys())[0])
if not allow_multiple_connected_components and len(odd) > 3:
return None
return None # pragma: no cover
stack = [odd[0]]
path = []

Expand Down
2 changes: 1 addition & 1 deletion hobart/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
def create_open_box():
v_on_faces_to_remove = np.nonzero(box_vertices[:, 0] < 0.0)[0]
faces_to_remove = np.all(
np.in1d(box_faces.ravel(), v_on_faces_to_remove).reshape((-1, 3)), axis=1,
np.in1d(box_faces.ravel(), v_on_faces_to_remove).reshape((-1, 3)), axis=1
)
return box_faces[~faces_to_remove]

Expand Down

0 comments on commit 1162bfe

Please sign in to comment.