def max_capacity(self, max_capacity): if not isinstance(max_capacity, (float, int)): raise e.TypeError('`max_capacity` should be a float or integer') if max_capacity < 0: raise e.ValueError('`max_capacity` should be >= 0') self._max_capacity = max_capacity
def dims(self, dims): if not isinstance(dims, int): raise e.TypeError('`dims` should be a integer') if (dims < -1 or dims == 0): raise e.ValueError('`dims` should be >= -1 and different than 0') self._dims = dims
def test_type_error(): new_exception = exception.TypeError('error') try: raise new_exception except exception.TypeError: pass
def weights(self, weights): if not isinstance(weights, tuple): raise e.TypeError('`weights` should be a tuple') self._weights = weights
def values(self, values): if not isinstance(values, tuple): raise e.TypeError('`values` should be a tuple') self._values = values
def continuous(self, continuous): if not isinstance(continuous, bool): raise e.TypeError('`continuous` should be a boolean') self._continuous = continuous
def name(self, name): if not isinstance(name, str): raise e.TypeError('`name` should be a string') self._name = name
def separable(self, separable): if not isinstance(separable, bool): raise e.TypeError('`separable` should be a boolean') self._separable = separable
def multimodal(self, multimodal): if not isinstance(multimodal, bool): raise e.TypeError('`multimodal` should be a boolean') self._multimodal = multimodal
def differentiable(self, differentiable): if not isinstance(differentiable, bool): raise e.TypeError('`differentiable` should be a boolean') self._differentiable = differentiable
def convex(self, convex): if not isinstance(convex, bool): raise e.TypeError('`convex` should be a boolean') self._convex = convex
def year(self, year): if not isinstance(year, str): raise e.TypeError('`year` should be a string') self._year = year