Esempio n. 1
0
 def __init__(self,
              louver_count,
              depth,
              offset=0,
              angle=0,
              contour_vector=Vector2D(0, 1),
              flip_start_side=False):
     """Initialize LouversByCount."""
     self._louver_count = int_positive(louver_count, 'louver count')
     _LouversBase.__init__(self, depth, offset, angle, contour_vector,
                           flip_start_side)
Esempio n. 2
0
def test_int_positive():
    """Test the int_positive method."""
    assert isinstance(int_positive(2.0), int)
    assert isinstance(int_positive(2), int)
    assert isinstance(int_positive('2'), int)

    with pytest.raises(AssertionError):
        assert isinstance(int_positive(-2), float)
    with pytest.raises(TypeError):
        assert isinstance(int_positive('two'), float)
    with pytest.raises(TypeError):
        assert isinstance(int_positive([2]), float)

    try:
        int_positive(-2, 'test number')
    except AssertionError as e:
        assert 'test number' in str(e)
 def direct_normal_irradiance(self, value):
     value = typing.int_positive(value, 'Direct normal irradiance')
     self._direct_normal_irradiance = value
 def diffuse_horizontal_irradiance(self, value):
     value = typing.int_positive(value, 'Diffuse horizontal irradiance')
     self._diffuse_horizontal_irradiance = value
Esempio n. 5
0
 def timestep(self, value):
     value = int_positive(value, 'simulation parameter timestep')
     assert value in self.VALIDTIMESTEPS, 'SimulationParameter timestep "{}" is ' \
         'invalid. Must be one of the following:{}'.format(value, self.VALIDTIMESTEPS)
     self._timestep = value
Esempio n. 6
0
 def analysis_years(self, value):
     self._analysis_years = int_positive(
         value, input_name='financial parameter analysis years')