Beispiel #1
0
    def setUp(self):
        builder = GraphBuilder()
        id = builder.process("get_collection", {'name': 'S1'})

        connection = MagicMock(spec=Connection)
        capabilities = MagicMock(spec=Capabilities)

        connection.capabilities.return_value = capabilities
        capabilities.version.return_value = "0.4.0"
        self.img = ImageCollectionClient(id, builder, connection)

        builder = GraphBuilder()
        mask_id = builder.process("get_collection", {'name': 'S1_Mask'})
        self.mask = ImageCollectionClient(mask_id, builder, connection)
Beispiel #2
0
def image_collection():
    builder = GraphBuilder()
    id = builder.process("get_collection", {'name': 'S1'})

    connection = MagicMock(spec=Connection)
    capabilities = MagicMock(spec=Capabilities)

    connection.capabilities.return_value = capabilities
    capabilities.version.return_value = "0.4.0"
    return ImageCollectionClient(id, builder, connection)
Beispiel #3
0
def test_empty_mask():
    from shapely import geometry
    polygon = geometry.Polygon([[1.0, 1.0], [2.0, 1.0], [2.0, 1.0], [1.0,
                                                                     1.0]])

    client = ImageCollectionClient(node_id=None,
                                   builder=GraphBuilder(),
                                   session=None)

    with pytest.raises(ValueError, match=r"Mask .+ has an area of 0.0"):
        client.mask(polygon)