示例#1
0
def test_material_lockability():
    """Test the lockability of the EnergyMaterial."""
    concrete = EnergyMaterial('Concrete [HW]', 0.2, 0.5, 800, 1200)
    concrete.density = 600
    concrete.lock()
    with pytest.raises(AttributeError):
        concrete.density = 700
    concrete.unlock()
    concrete.density = 700
示例#2
0
def test_material_invalid():
    """Test the initialization of EnergyMaterial objects with invalid properties."""
    concrete = EnergyMaterial('Concrete', 0.2, 0.5, 800, 1200)

    with pytest.raises(TypeError):
        concrete.identifier = ['test_identifier']
    with pytest.raises(AssertionError):
        concrete.thickness = -1
    with pytest.raises(AssertionError):
        concrete.conductivity = -1
    with pytest.raises(AssertionError):
        concrete.density = -1
    with pytest.raises(AssertionError):
        concrete.specific_heat = -1
    with pytest.raises(AssertionError):
        concrete.roughness = 'Medium'
    with pytest.raises(AssertionError):
        concrete.thermal_absorptance = 2
    with pytest.raises(AssertionError):
        concrete.solar_absorptance = 2
    with pytest.raises(AssertionError):
        concrete.visible_absorptance = 2

    with pytest.raises(AssertionError):
        concrete.resistivity = -1
    with pytest.raises(AssertionError):
        concrete.u_value = -1
    with pytest.raises(AssertionError):
        concrete.r_value = -1