Beispiel #1
0
def test_from_rooms_radial():
    runner = CliRunner()
    input_hb_model = './tests/assets/model/model_radiance_dynamic_states.hbjson'

    result = runner.invoke(from_rooms_radial, [input_hb_model])
    assert result.exit_code == 0
    sg_dict = json.loads(result.output)
    new_grids = [SensorGrid.from_dict(sg) for sg in sg_dict]
    assert len(new_grids) == 2
    assert all(isinstance(sg, SensorGrid) for sg in new_grids)
Beispiel #2
0
def test_to_and_from_dict():
    sg = SensorGrid('sg', sensors)
    sg_dict = sg.to_dict()
    assert sg_dict == {
        'type':
        'SensorGrid',
        'identifier':
        'sg',
        'sensors': [{
            'pos': (0, 0, 0),
            'dir': (0, 0, 1)
        }, {
            'pos': (0, 0, 10),
            'dir': (0, 0, 1)
        }]
    }

    sensor_from = SensorGrid.from_dict(sg_dict)
    assert sensor_from == sg
    assert sg_dict == sensor_from.to_dict()