Ejemplo n.º 1
0
def test_material_equivalency():
    """Test the equality of a material to another Glass."""
    gl_1 = Glass('test_glass', 0.6, 0.7, 0.8, 1.52)
    gl_2 = gl_1.duplicate()
    gl_3 = Glass('test_glass2', 0.8, 0.7, 0.8, 1.52)

    assert gl_1 is gl_1
    assert gl_1 is not gl_2
    assert gl_1 == gl_2
    assert gl_1 != gl_3
    collection = [gl_1, gl_2, gl_3]
    assert len(set(collection)) == 2
Ejemplo n.º 2
0
def test_glass():
    gl = Glass('test_glass')
    assert gl.r_transmissivity == 0
    assert gl.g_transmissivity == 0
    assert gl.b_transmissivity == 0
    assert gl.refraction_index is None
    assert gl.to_radiance(
        minimal=True) == 'void glass test_glass 0 0 3 0.0 0.0 0.0'
Ejemplo n.º 3
0
def test_assign_values():
    gl = Glass('test_glass', 0.6, 0.7, 0.8, 1.52)
    assert gl.r_transmissivity == 0.6
    assert gl.g_transmissivity == 0.7
    assert gl.b_transmissivity == 0.8
    assert gl.refraction_index == 1.52
    assert gl.to_radiance(
        minimal=True) == 'void glass test_glass 0 0 4 0.6 0.7 0.8 1.52'
Ejemplo n.º 4
0
 def _transparent_radiance_material():
     """Get a transparent radiance material for the air boundary."""
     try:
         from honeybee_radiance.modifier.material import Glass
     except ImportError as e:
         raise ImportError(
             'honeybee_radiance library must be installed to use '
             'to_radiance() method. {}'.format(e))
     return Glass('air_boundary', 1, 1, 1)
Ejemplo n.º 5
0
def test_material_lockability():
    """Test the lockability of Glass."""
    gl = Glass('test_glass', 0.6, 0.7, 0.8, 1.52)
    gl.r_transmissivity = 0.5
    gl.lock()
    with pytest.raises(AttributeError):
        gl.r_transmissivity = 0.7
    gl.unlock()
    gl.r_transmissivity = 0.7
Ejemplo n.º 6
0
def test_update_values():
    gl = Glass('test_glass', 0.6, 0.7, 0.8, 1.52)
    gl.r_transmissivity = 0.5
    gl.g_transmissivity = 0.4
    gl.b_transmissivity = 0.3
    gl.refraction_index = 1.4
    assert gl.r_transmissivity == 0.5
    assert gl.g_transmissivity == 0.4
    assert gl.b_transmissivity == 0.3
    assert gl.refraction_index == 1.4
    assert gl.to_radiance(
        minimal=True) == 'void glass test_glass 0 0 4 0.5 0.4 0.3 1.4'
Ejemplo n.º 7
0
def test_dict_to_object_modifier():
    """Test the dict_to_object method with Modifier objects."""
    gl_obj = Glass('test_glass', 0.6, 0.7, 0.8, 1.52)
    gl_dict = gl_obj.to_dict()
    new_gl = dict_to_object(gl_dict)
    assert isinstance(new_gl, Glass)