Beispiel #1
0
def test_developer_dict_roundtrip(res10):
    dev1 = develop.Developer(**res10)
    config1 = dev1.to_dict

    next_args = config1.copy()
    next_args.update(res10)

    dev2 = develop.Developer(**next_args)
    config2 = dev2.to_dict

    assert config1 == config2
Beispiel #2
0
def test_res_developer(res):
    dev = develop.Developer(target_units=10, **res)
    bldgs = dev.pick()
    assert len(bldgs) == 1
    assert len(dev.feasibility) == 2

    dev = develop.Developer(target_units=1000, **res)
    bldgs = dev.pick()
    assert len(bldgs) == 3

    dev = develop.Developer(target_units=2, residential=False, **res)
    bldgs = dev.pick()
    assert bldgs is None
Beispiel #3
0
def test_res_developer_multi_proposals(res_multi_proposals):
    dev = develop.Developer(target_units=10,
                            keep_suboptimal=True,
                            **res_multi_proposals)
    bldgs = dev.pick()
    assert len(bldgs) == 1

    dev = develop.Developer(target_units=1000,
                            keep_suboptimal=True,
                            **res_multi_proposals)
    bldgs = dev.pick()
    assert len(bldgs) == 3

    dev = develop.Developer(target_units=2,
                            residential=False,
                            keep_suboptimal=True,
                            **res_multi_proposals)
    bldgs = dev.pick()
    assert bldgs is None
Beispiel #4
0
def test_developer_yaml_roundtrip(res10):
    if os.path.exists('test_dev_config.yaml'):
        os.remove('test_dev_config.yaml')

    dev = develop.Developer(**res10)
    with open('test_dev_config.yaml', 'w') as yaml_file:
        dev.to_yaml(yaml_file)
        yaml_string = dev.to_yaml()

    dev_from_yaml_file = develop.Developer.from_yaml(
        str_or_buffer='test_dev_config.yaml', **res10)
    assert dev.to_dict == dev_from_yaml_file.to_dict

    dev_from_yaml_string = develop.Developer.from_yaml(yaml_str=yaml_string,
                                                       **res10)
    assert dev.to_dict == dev_from_yaml_string.to_dict

    os.remove('test_dev_config.yaml')
Beispiel #5
0
def test_developer_compute_forms_max_profit(res10):
    dev = develop.Developer(**res10)
    dev.keep_form_with_max_profit()