Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
def test_type_error():
    new_exception = exception.TypeError('error')

    try:
        raise new_exception
    except exception.TypeError:
        pass
Exemplo n.º 4
0
    def weights(self, weights):
        if not isinstance(weights, tuple):
            raise e.TypeError('`weights` should be a tuple')

        self._weights = weights
Exemplo n.º 5
0
    def values(self, values):
        if not isinstance(values, tuple):
            raise e.TypeError('`values` should be a tuple')

        self._values = values
Exemplo n.º 6
0
    def continuous(self, continuous):
        if not isinstance(continuous, bool):
            raise e.TypeError('`continuous` should be a boolean')

        self._continuous = continuous
Exemplo n.º 7
0
    def name(self, name):
        if not isinstance(name, str):
            raise e.TypeError('`name` should be a string')

        self._name = name
Exemplo n.º 8
0
    def separable(self, separable):
        if not isinstance(separable, bool):
            raise e.TypeError('`separable` should be a boolean')

        self._separable = separable
Exemplo n.º 9
0
    def multimodal(self, multimodal):
        if not isinstance(multimodal, bool):
            raise e.TypeError('`multimodal` should be a boolean')

        self._multimodal = multimodal
Exemplo n.º 10
0
    def differentiable(self, differentiable):
        if not isinstance(differentiable, bool):
            raise e.TypeError('`differentiable` should be a boolean')

        self._differentiable = differentiable
Exemplo n.º 11
0
    def convex(self, convex):
        if not isinstance(convex, bool):
            raise e.TypeError('`convex` should be a boolean')

        self._convex = convex
Exemplo n.º 12
0
    def year(self, year):
        if not isinstance(year, str):
            raise e.TypeError('`year` should be a string')

        self._year = year