Skip to content

Commit

Permalink
Merge pull request #354 from kevinfoley/kevinfoley/better-assertion-e…
Browse files Browse the repository at this point in the history
…rrors

representation.py: better assertion errors
  • Loading branch information
hwiedPro authored May 16, 2024
2 parents d27a70b + c524192 commit e359008
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phobos/io/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,13 @@ def __init__(self, filepath=None, posix_path=None, scale=None, mesh=None, meshna
self.material = material
filepath = misc.sys_path(filepath if posix_path is None else posix_path)
if mesh is not None:
assert meshname is not None and type(meshname) == str
if meshname is None or type(meshname) != str:
raise AssertionError(f"Invalid mesh name {meshname}.")
self.original_mesh_name = meshname
self._mesh_object = mesh
self.input_type = str(type(mesh))[8:-2] # handle: <class 'the type name'>
assert self.input_type in MESH_DATA_TYPES
if self.input_type not in MESH_DATA_TYPES:
raise AssertionError(f"The input type {self.input_type} of object {meshname} is not recognized.")
self.input_file = None
self.unique_name = meshname
self._mesh_information = None
Expand Down

0 comments on commit e359008

Please sign in to comment.