def test_layer_nonzero(): map = desert() assert map.layers[0] layer = map.add_layer('Tile layer') assert not layer layer[0, 0] = 1 assert layer layer = map.add_object_layer('Object layer') assert not layer layer.append(tmxlib.RectangleObject(layer, (0, 0), size=(3, 3))) assert layer layer[:] = [] assert not layer layer.append(tmxlib.EllipseObject(layer, (0, 0), size=(3, 3))) assert layer layer[:] = [] assert not layer layer.append(tmxlib.RectangleObject(layer, (0, 0), value=4)) assert layer
def test_remove_used_tileset(): map = desert() with pytest.raises(tmxlib.UsedTilesetError): del map.tilesets[0]
def test_bad_layer_by_name(): with pytest.raises(KeyError): desert().layers['(nonexisting)']