Example #1
0
def test_areas_append():
    """Ensure Area objects can be appended to an Areas."""
    a = Areas()

    area = Area()
    a.append(area)

    assert 1 == len(a)
Example #2
0
def test_areas_remove():
    """Ensure Areas.remove() behaves like list.remove()."""
    a = Areas()

    area = Area()
    a.append(area)
    a.remove(area)

    assert 0 == len(a)
Example #3
0
def test_areas_append_wrong_type():
    """Ensure a TypeError is raised when non-Area objects are appended
    to an Areas."""
    a = Areas()
    with pytest.raises(TypeError) as e:
        a.append('1')

    assert str(e.value) == (
        '1 is not an Area. Only Area objects can be inside Areas.'
    )