diff --git a/PySDM/products/impl/product.py b/PySDM/products/impl/product.py index 60f15b438..7164b03b7 100644 --- a/PySDM/products/impl/product.py +++ b/PySDM/products/impl/product.py @@ -16,6 +16,7 @@ class Product: def __init__(self, *, unit: str, name: Optional[str] = None): + self.non_default_name = name is not None self.name = name or camel_case_to_words(self.__class__.__name__) self._unit = self._parse_unit(unit) @@ -87,6 +88,12 @@ def __check_unit(self): f" for product {type(self).__name__}" ) + if self._unit != default_unit and not self.non_default_name: + raise AssertionError( + f"custom non-SI unit specified for product {type(self).__name__}" + " requires a custom name (intention: include the custom unit in the name)" + ) + @property def unit(self): return str(self._unit)