def test_material_nomass_invalid(): """Test the initialization of EnergyMaterial objects with invalid properties.""" insul_r2 = EnergyMaterialNoMass('Insulation [R-2]', 2) with pytest.raises(TypeError): insul_r2.identifier = ['test_identifier'] with pytest.raises(AssertionError): insul_r2.r_value = -1 with pytest.raises(AssertionError): insul_r2.roughness = 'Medium' with pytest.raises(AssertionError): insul_r2.thermal_absorptance = 2 with pytest.raises(AssertionError): insul_r2.solar_absorptance = 2 with pytest.raises(AssertionError): insul_r2.visible_absorptance = 2 with pytest.raises(AssertionError): insul_r2.u_value = -1
def test_material_nomass_init(): """Test the initialization of EnergyMaterialNoMass and basic properties.""" insul_r2 = EnergyMaterialNoMass('Insulation R-2', 2, 'MediumSmooth', 0.95, 0.75, 0.8) str(insul_r2) # test the string representation of the material insul_r2_dup = insul_r2.duplicate() assert insul_r2.identifier == insul_r2_dup.identifier == 'Insulation R-2' assert insul_r2.r_value == insul_r2_dup.r_value == 2 assert insul_r2.roughness == insul_r2_dup.roughness == 'MediumSmooth' assert insul_r2.thermal_absorptance == insul_r2_dup.thermal_absorptance == 0.95 assert insul_r2.solar_absorptance == insul_r2_dup.solar_absorptance == 0.75 assert insul_r2.visible_absorptance == insul_r2_dup.visible_absorptance == 0.8 assert insul_r2.u_value == pytest.approx(0.5, rel=1e-2) assert insul_r2.r_value == pytest.approx(2, rel=1e-2) insul_r2.r_value = 3 assert insul_r2.r_value == 3