safe.utilities.test.test_clipper module

InaSAFE Disaster risk assessment tool by AusAid - Clipper test suite.

Contact : ole.moller.nielsen@gmail.com

Note

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

class safe.utilities.test.test_clipper.ClipperTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test the InaSAFE clipper

setUp()[source]

Runs before each test.

tearDown()[source]

Runs after each test.

test_adjust_clip_extent()[source]

Test adjust_clip_extent works as expected.

test_clip_both()[source]

Raster and Vector layers can be clipped.

test_clip_geometry()[source]

Test that we can clip a geometry using another geometry.

test_clip_one_pixel(*args, **kwargs)[source]

Test for clipping less than one pixel.

test_clip_raster()[source]

Raster layers can be clipped.

test_clip_raster_with_no_extension()[source]

Test we can clip a raster with no extension - see #659.

test_clip_vector()[source]

Vector layers can be clipped.

test_clip_vector_hard()[source]

Vector layers can be hard clipped.

Hard clipping will remove any dangling, non intersecting elements.

test_clip_vector_with_unicode()[source]

Test clipping vector layer with unicode attribute in feature.

This issue is described at Github #2262 and #2233 TODO: FIXME: This is a hacky fix. See above ticket for further explanation. To fix this, we should be able to specify UTF-8 encoding for QgsVectorFileWriter

test_explode_multi_line_geometry()[source]

Test exploding LINES multipart to single part geometries works.

test_explode_multi_point_geometry()[source]

Test exploding POINT multipart to single part geometries works

test_explode_multi_polygon_geometry()[source]

Test exploding POLY multipart to single part geometries works.

test_extent_to_kml()[source]

Test if extent to KML is working.

test_invalid_filenames_caught()[source]

Invalid filenames raise appropriate exceptions.

Wrote this test because test_clipBoth raised the wrong error when file was missing. Instead of reporting that, it gave Western boundary must be less than eastern. I got [0.0, 0.0, 0.0, 0.0]

See issue #170

test_raster_scaling()[source]

Raster layers can be scaled when resampled.

This is a test for ticket #52

Native test .asc data has

Population_Jakarta_geographic.asc ncols 638 nrows 649 cellsize 0.00045228819716044

Population_2010.asc ncols 5525 nrows 2050 cellsize 0.0083333333333333

Scaling is necessary for raster data that represents density such as population per km^2

test_raster_scaling_projected()[source]

Attempt to scale projected density raster layers raise exception.

Automatic scaling when resampling density data does not currently work for projected layers. See issue #123.

For the time being this test checks that an exception is raised when scaling is attempted on projected layers. When we resolve issue #123, this test should be rewritten.

test_vector_projections()[source]

Test that vector input data is reprojected properly during clip.