Exemplo n.º 1
0
def test_where_to_add_values_link_bc(four_by_four_raster, at, link_bc):
    if at == "link":
        where = _where_to_add_values(four_by_four_raster, at, link_bc)
        assert len(where) == four_by_four_raster.number_of_links
    elif at == "node":
        with pytest.raises(ValueError):
            _where_to_add_values(four_by_four_raster, at, link_bc)
    else:
        with pytest.raises(AttributeError):
            _where_to_add_values(four_by_four_raster, at, link_bc)
Exemplo n.º 2
0
def test_where_to_add_values_link_bc(four_by_four_raster, at, link_bc):
    if at == "link":
        where = _where_to_add_values(four_by_four_raster, at, link_bc)
        assert len(where) == four_by_four_raster.number_of_links
    elif at == "node":
        with pytest.raises(ValueError):
            _where_to_add_values(four_by_four_raster, at, link_bc)
    else:
        with pytest.raises(AttributeError):
            _where_to_add_values(four_by_four_raster, at, link_bc)
Exemplo n.º 3
0
def test_where_to_add_values_where_is_somewhere(four_by_four_raster, at):
    where = np.random.randint(0,
                              2,
                              size=four_by_four_raster.size(at),
                              dtype=bool)
    assert np.all(
        _where_to_add_values(four_by_four_raster, at, where) == where)
Exemplo n.º 4
0
def test_where_to_add_values_with_bad_at(four_by_four_raster):
    with pytest.raises(GroupError):
        _where_to_add_values(four_by_four_raster, "not-a-place", None)
Exemplo n.º 5
0
def test_where_to_add_values_wrong_size(four_by_four_raster, at):
    where = np.full(four_by_four_raster.size(at) - 1, False)
    with pytest.raises(ValueError):
        _where_to_add_values(four_by_four_raster, at, where)
Exemplo n.º 6
0
def test_where_to_add_values_where_is_somewhere(four_by_four_raster, at):
    where = np.random.randint(0, 2, size=four_by_four_raster.size(at), dtype=bool)
    assert np.all(_where_to_add_values(four_by_four_raster, at, where) == where)
Exemplo n.º 7
0
def test_where_to_add_values_where_is_nowhere(four_by_four_raster, at):
    where = np.full(four_by_four_raster.size(at), False)
    assert np.all(_where_to_add_values(four_by_four_raster, at, where) == where)
Exemplo n.º 8
0
def test_where_to_add_values_where_is_none(four_by_four_raster, at):
    where = _where_to_add_values(four_by_four_raster, at, None)
    assert np.all(where == np.full(four_by_four_raster.size(at), True))
Exemplo n.º 9
0
def test_where_to_add_values_with_bad_at(four_by_four_raster):
    with pytest.raises(GroupError):
        _where_to_add_values(four_by_four_raster, "not-a-place", None)
Exemplo n.º 10
0
def test_where_to_add_values_wrong_size(four_by_four_raster, at):
    where = np.full(four_by_four_raster.size(at) - 1, False)
    with pytest.raises(ValueError):
        _where_to_add_values(four_by_four_raster, at, where)
Exemplo n.º 11
0
def test_where_to_add_values_where_is_nowhere(four_by_four_raster, at):
    where = np.full(four_by_four_raster.size(at), False)
    assert np.all(
        _where_to_add_values(four_by_four_raster, at, where) == where)
Exemplo n.º 12
0
def test_where_to_add_values_where_is_none(four_by_four_raster, at):
    where = _where_to_add_values(four_by_four_raster, at, None)
    assert np.all(where == np.full(four_by_four_raster.size(at), True))