本文整理汇总了Python中safe.test.utilities.load_layer函数的典型用法代码示例。如果您正苦于以下问题:Python load_layer函数的具体用法?Python load_layer怎么用?Python load_layer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_layer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_zonal_with_exact_cell_boundaries
def test_zonal_with_exact_cell_boundaries(self):
"""Test that zonal stats returns the expected output."""
raster_layer, _ = load_layer(
test_data_path('other', 'tenbytenraster.asc'))
# Note this is a matrix of 11x11 polygons - one per cell
# and one poly extending beyond to the right of each row
# and one poly extending beyond the bottom of each col
vector_layer, _ = load_layer(
test_data_path('other', 'ten_by_ten_raster_as_polys.shp'))
result = calculate_zonal_stats(
raster_layer=raster_layer,
polygon_layer=vector_layer)
expected_result = {
0L: {'count': 1.0, 'sum': 0.0, 'mean': 0.0}, # TL polygon
9L: {'count': 1.0, 'sum': 9.0, 'mean': 9.0}, # TR polygon
25L: {'count': 1.0, 'sum': 3.0, 'mean': 3.0}, # Central polygon
88L: {'count': 1.0, 'sum': 0.0, 'mean': 0.0}, # BL polygon
108L: {'count': 1.0, 'sum': 9.0, 'mean': 9.0}} # BR polygon
# We will just check TL, TR, Middle, BL and BR cells
result = {
0L: result[0L],
9L: result[9L],
25L: result[25L],
88L: result[88L],
108L: result[108L]}
# noinspection PyPep8Naming
self.maxDiff = None
self.assertDictEqual(expected_result, result)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:28,代码来源:test_zonal_stats.py
示例2: setUp
def setUp(self):
self.keyword_io = KeywordIO()
# SQLite Layer
uri = QgsDataSourceURI()
sqlite_building_path = standard_data_path(
'exposure', 'exposure.sqlite')
uri.setDatabase(sqlite_building_path)
uri.setDataSource('', 'buildings_osm_4326', 'Geometry')
self.sqlite_layer = QgsVectorLayer(
uri.uri(), 'OSM Buildings', 'spatialite')
self.expected_sqlite_keywords = {
'datatype': 'OSM'
}
# Raster Layer keywords
hazard_path = standard_data_path('hazard', 'tsunami_wgs84.tif')
self.raster_layer, _ = load_layer(hazard_path)
self.expected_raster_keywords = {
'hazard_category': 'single_event',
'title': 'Generic Continuous Flood',
'hazard': 'flood',
'continuous_hazard_unit': 'generic',
'layer_geometry': 'raster',
'layer_purpose': 'hazard',
'layer_mode': 'continuous',
'keyword_version': '3.5'
}
# Vector Layer keywords
vector_path = standard_data_path('exposure', 'buildings_osm_4326.shp')
self.vector_layer, _ = load_layer(vector_path)
self.expected_vector_keywords = {
'keyword_version': '3.5',
'structure_class_field': 'FLOODED',
'value_mapping': {},
'title': 'buildings_osm_4326',
'layer_geometry': 'polygon',
'layer_purpose': 'exposure',
'layer_mode': 'classified',
'exposure': 'structure',
}
# Keyword less layer
keywordless_path = standard_data_path('other', 'keywordless_layer.shp')
self.keywordless_layer, _ = load_layer(keywordless_path)
# Keyword file
self.keyword_path = standard_data_path(
'exposure', 'buildings_osm_4326.xml')
开发者ID:easmetz,项目名称:inasafe,代码行数:48,代码来源:test_keyword_io.py
示例3: test_convert_grid_to_raster_with_ascii
def test_convert_grid_to_raster_with_ascii(self):
"""Test converting grid.xml to raster (tif file)"""
grid_title = 'Earthquake'
grid_source = 'USGS'
output_raster = unique_filename(
prefix='result_grid',
suffix='.tif',
dir=temp_dir('test'))
result = convert_mmi_data(
GRID_PATH,
grid_title,
grid_source,
algorithm=USE_ASCII,
output_path=output_raster)
expected_result = output_raster.replace('.tif', '-%s.tif' % USE_ASCII)
self.assertEqual(
result, expected_result,
'Result path not as expected')
exists = os.path.exists(result)
self.assertTrue(exists, 'File result : %s does not exist' % result)
exists = os.path.exists(result[:-3] + 'xml')
self.assertTrue(
exists,
'File result : %s does not exist' % result[:-3] + 'xml')
exists = os.path.exists(result[:-3] + 'qml')
self.assertTrue(
exists,
'File result : %s does not exist' % result[:-3] + 'qml')
tif_file = load_layer(result)[0]
keywords = tif_file.keywords
self.assertEqual(keywords['hazard'], hazard_earthquake['key'])
population_classification = list(keywords['thresholds'][
exposure_population['key']].keys())[0]
self.assertEqual(
population_classification, earthquake_mmi_scale['key'])
开发者ID:inasafe,项目名称:inasafe,代码行数:35,代码来源:test_shake_grid.py
示例4: Xtest_print_impact_table
def Xtest_print_impact_table(self):
"""Test print impact table to pdf."""
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
# noinspection PyUnresolvedReferences,PyArgumentList
QgsMapLayerRegistry.instance().addMapLayer(layer)
# noinspection PyCallingNonCallable
rect = QgsRectangle(106.8194, -6.2108, 106.8201, -6.1964)
CANVAS.setExtent(rect)
CANVAS.refresh()
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
report.template = template # just to cover set template
out_path = unique_filename(
prefix='test_print_impact_table',
suffix='.pdf',
dir=temp_dir('test'))
report.print_impact_table(out_path)
# Check the file exists
message = 'Rendered output does not exist: %s' % out_path
self.assertTrue(os.path.exists(out_path), message)
# Check the file is not corrupt
message = 'The output file %s is corrupt' % out_path
out_size = os.stat(out_path).st_size
self.assertTrue(out_size > 0, message)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:30,代码来源:test_impact_report.py
示例5: test_transparency_of_minimum_value
def test_transparency_of_minimum_value(self):
"""Test that transparency of minimum value works when set to 100%
"""
# This dataset has all cells with value 1.3
data_path = test_data_path('other', 'issue126.tif')
layer, _ = load_layer(data_path)
# Note the float quantity values below
style_info = {
'style_classes': [
{'colour': '#FFFFFF', 'transparency': 100, 'quantity': 0.0},
{'colour': '#38A800', 'quantity': 0.038362596547925065,
'transparency': 0, 'label': u'Rendah [0 orang/sel]'},
{'colour': '#79C900', 'transparency': 0,
'quantity': 0.07672519309585013},
{'colour': '#CEED00', 'transparency': 0,
'quantity': 0.1150877896437752},
{'colour': '#FFCC00', 'quantity': 0.15345038619170026,
'transparency': 0, 'label': u'Sedang [0 orang/sel]'},
{'colour': '#FF6600', 'transparency': 0,
'quantity': 0.19181298273962533},
{'colour': '#FF0000', 'transparency': 0,
'quantity': 0.23017557928755039},
{'colour': '#7A0000', 'quantity': 0.26853817583547546,
'transparency': 0, 'label': u'Tinggi [0 orang/sel]'}]}
try:
setRasterStyle(layer, style_info)
except Exception, e:
message = '\nCould not create raster style'
e.args = (e.args[0] + message,)
raise
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:32,代码来源:test_styling.py
示例6: test_print_default_template
def test_print_default_template(self):
"""Test printing report to pdf using default template works."""
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
# noinspection PyUnresolvedReferences
QgsMapLayerRegistry.instance().addMapLayer(layer)
# noinspection PyCallingNonCallable
rect = QgsRectangle(106.8194, -6.2108, 106.8201, -6.1964)
CANVAS.setExtent(rect)
CANVAS.refresh()
template = resources_path(
'qgis-composer-templates', 'inasafe-portrait-a4.qpt')
report = ImpactReport(IFACE, template, layer)
out_path = unique_filename(
prefix='map_default_template_test',
suffix='.pdf',
dir=temp_dir('test'))
report.print_map_to_pdf(out_path)
# Check the file exists
message = 'Rendered output does not exist: %s' % out_path
self.assertTrue(os.path.exists(out_path), message)
# Check the file is not corrupt
message = 'The output file %s is corrupt' % out_path
out_size = os.stat(out_path).st_size
self.assertTrue(out_size > 0, message)
# Check the components in composition are default components
if qgis_version() < 20500:
safe_logo = report.composition.getComposerItemById(
'safe-logo').pictureFile()
north_arrow = report.composition.getComposerItemById(
'north-arrow').pictureFile()
org_logo = report.composition.getComposerItemById(
'organisation-logo').pictureFile()
else:
safe_logo = report.composition.getComposerItemById(
'safe-logo').picturePath()
north_arrow = report.composition.getComposerItemById(
'north-arrow').picturePath()
org_logo = report.composition.getComposerItemById(
'organisation-logo').picturePath()
expected_safe_logo = resources_path(
'img', 'logos', 'inasafe-logo-url.svg')
expected_north_arrow = resources_path(
'img', 'north_arrows', 'simple_north_arrow.png')
expected_org_logo = resources_path('img', 'logos', 'supporters.png')
message = 'The safe logo path is not the default one'
self.assertEqual(expected_safe_logo, safe_logo, message)
message = 'The north arrow path is not the default one'
self.assertEqual(expected_north_arrow, north_arrow, message)
message = 'The organisation logo path is not the default one'
self.assertEqual(expected_org_logo, org_logo, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:60,代码来源:test_impact_report.py
示例7: test_retrieve_exposure_classes_lists
def test_retrieve_exposure_classes_lists(self):
"""Test retrieve_exposure_classes_lists method.
.. versionadded:: 4.0
"""
layer_paths = self.layer_paths_list
expected_classes_lists = [
None,
None,
None,
None,
generic_structure_classes['classes'],
generic_structure_classes['classes'],
None,
generic_road_classes['classes']
]
for layer_path, expected_classes in zip(
layer_paths, expected_classes_lists):
path = standard_data_path(*layer_path)
layer, _ = load_layer(path)
actual_classes = retrieve_exposure_classes_lists(layer)
try:
self.assertEqual(
expected_classes, actual_classes)
except Exception as e:
LOGGER.error('Layer path: {path}'.format(
path=path))
LOGGER.error('Expected {classes}'.format(
classes=expected_classes))
LOGGER.error('Actual {classes}'.format(
classes=actual_classes))
raise e
开发者ID:timlinux,项目名称:inasafe,代码行数:33,代码来源:test_util.py
示例8: test_layer_definition_type
def test_layer_definition_type(self):
"""Test layer_definition_type method.
.. versionadded:: 4.0
"""
layer_paths = self.layer_paths_list
expected_definitions = [
hazard_generic,
hazard_earthquake,
hazard_tsunami,
hazard_cyclone,
exposure_structure,
exposure_structure,
exposure_population,
exposure_road,
]
for layer_path, expected_definition in zip(
layer_paths, expected_definitions):
path = standard_data_path(*layer_path)
layer, _ = load_layer(path)
actual_definition = layer_definition_type(layer)
try:
self.assertEqual(expected_definition, actual_definition)
except Exception as e:
LOGGER.error('Layer path: {path}'.format(
path=path))
LOGGER.error('Expected {name}'.format(
**expected_definition))
LOGGER.error('Actual {name}'.format(
**actual_definition))
raise e
开发者ID:timlinux,项目名称:inasafe,代码行数:31,代码来源:test_util.py
示例9: test_zonal
def test_zonal(self):
"""Test that zonal stats returns the expected output."""
raster_layer, _ = load_layer(
test_data_path('other', 'tenbytenraster.asc'))
vector_layer, _ = load_layer(
test_data_path('other', 'zonal_polygons.shp'))
result = calculate_zonal_stats(
raster_layer=raster_layer,
polygon_layer=vector_layer)
expected_result = {
0L: {'count': 4, 'sum': 34.0, 'mean': 8.5}, # BR polygon
1L: {'count': 9, 'sum': 36.0, 'mean': 4.0}, # center polygon
2L: {'count': 4, 'sum': 2.0, 'mean': 0.5}, # TL polygon
3L: {'count': 4, 'sum': 2.0, 'mean': 0.5}, # BL Polygon
4L: {'count': 4, 'sum': 34.0, 'mean': 8.5}} # TR polygon
# noinspection PyPep8Naming
self.maxDiff = None
self.assertDictEqual(expected_result, result)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:18,代码来源:test_zonal_stats.py
示例10: test_handle_missing_map_title
def test_handle_missing_map_title(self):
"""Missing map title from the keywords fails gracefully"""
# Use hazard layer as it won't have 'map_title' keyword
layer_path = test_data_path('hazard', 'tsunami_wgs84.tif')
layer, _ = load_layer(layer_path)
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
title = report.map_title
expected_title = None
message = 'Expected: %s\nGot:\n %s' % (expected_title, title)
self.assertEqual(title, expected_title, message)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:12,代码来源:test_impact_report.py
示例11: test_buffer_points
def test_buffer_points(self):
"""Test if we can make buffers correctly, whatever the projection."""
# Original data in 3857.
data_path = standard_data_path('other', 'buffer_points_3857.shp')
layer, _ = load_layer(data_path)
output_crs = qgis.core.QgsCoordinateReferenceSystem('EPSG:4326')
# Wrong radii order.
radii = [1, 5, 3]
self.assertRaises(
RadiiException, buffer_points, layer, radii, 'test', output_crs)
# Wrong projection
radii = [1, 2, 3]
output_crs = qgis.core.QgsCoordinateReferenceSystem('EPSG:3857')
result = buffer_points(layer, radii, 'test', output_crs)
data_path = standard_data_path(
'other', 'buffer_points_expected_4326.shp')
control_layer, _ = load_layer(data_path)
is_equal, msg = compare_two_vector_layers(control_layer, result)
self.assertFalse(is_equal, msg)
# Expected result in 4326.
output_crs = qgis.core.QgsCoordinateReferenceSystem('EPSG:4326')
result = buffer_points(layer, radii, 'test', output_crs)
data_path = standard_data_path(
'other', 'buffer_points_expected_4326.shp')
control_layer, _ = load_layer(data_path)
is_equal, msg = compare_two_vector_layers(control_layer, result)
self.assertTrue(is_equal, msg)
# Expected result in 3857.
output_crs = qgis.core.QgsCoordinateReferenceSystem('EPSG:3857')
result = buffer_points(layer, radii, 'test', output_crs)
data_path = standard_data_path(
'other', 'buffer_points_expected_3857.shp')
control_layer, _ = load_layer(data_path)
is_equal, msg = compare_two_vector_layers(control_layer, result)
self.assertTrue(is_equal, msg)
开发者ID:easmetz,项目名称:inasafe,代码行数:40,代码来源:test_gis.py
示例12: test_get_map_title
def test_get_map_title(self):
"""Getting the map title from the keywords"""
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
title = report.map_title
expected_title = 'People affected by flood prone areas'
message = 'Expected: %s\nGot:\n %s' % (expected_title, title)
self.assertEqual(title, expected_title, message)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:13,代码来源:test_impact_report.py
示例13: register_layers
def register_layers(self):
"""Register needed layers to QgsMapLayerRegistry."""
# Register 4 impact layers and aggregation layer
self.population_entire_jakarta_layer, _ = load_layer(
population_entire_jakarta_impact_path)
self.building_entire_jakarta_layer, _ = load_layer(
building_entire_jakarta_impact_path)
self.population_district_jakarta_layer, _ = load_layer(
population_district_jakarta_impact_path)
self.building_district_jakarta_layer, _ = load_layer(
building_district_jakarta_impact_path)
self.district_jakarta_layer, _ = load_layer(
district_jakarta_boundary_path)
layer_list = [self.population_entire_jakarta_layer,
self.population_district_jakarta_layer,
self.building_entire_jakarta_layer,
self.building_district_jakarta_layer,
self.district_jakarta_layer]
# noinspection PyArgumentList
self.map_layer_registry.addMapLayers(layer_list)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:22,代码来源:test_impact_merge_dialog.py
示例14: setUp
def setUp(self):
self.keyword_io = KeywordIO()
# SQLite Layer
uri = QgsDataSourceURI()
sqlite_building_path = test_data_path('exposure', 'exposure.sqlite')
uri.setDatabase(sqlite_building_path)
uri.setDataSource('', 'buildings_osm_4326', 'Geometry')
self.sqlite_layer = QgsVectorLayer(
uri.uri(), 'OSM Buildings', 'spatialite')
self.expected_sqlite_keywords = {
'category': 'exposure',
'datatype': 'OSM',
'subcategory': 'building'}
# Raster Layer keywords
hazard_path = test_data_path('hazard', 'tsunami_wgs84.tif')
self.raster_layer, _ = load_layer(hazard_path)
self.expected_raster_keywords = {
'category': 'hazard',
'subcategory': 'tsunami',
'data_type': 'continuous',
'unit': 'metres_depth',
'title': 'Tsunami'}
# Vector Layer keywords
vector_path = test_data_path('exposure', 'buildings_osm_4326.shp')
self.vector_layer, _ = load_layer(vector_path)
self.expected_vector_keywords = {
'category': 'exposure',
'datatype': 'osm',
'subcategory': 'structure',
'title': 'buildings_osm_4326',
'purpose': 'dki'}
# Keyword less layer
keywordless_path = test_data_path('other', 'keywordless_layer.shp')
self.keywordless_layer, _ = load_layer(keywordless_path)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:38,代码来源:test_keyword_io.py
示例15: test_custom_logo
def test_custom_logo(self):
"""Test that setting user-defined logo works."""
LOGGER.info('Testing custom_logo')
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
# noinspection PyUnresolvedReferences,PyArgumentList
QgsMapLayerRegistry.instance().addMapLayer(layer)
# noinspection PyCallingNonCallable
rect = QgsRectangle(106.8194, -6.2108, 106.8201, -6.1964)
CANVAS.setExtent(rect)
CANVAS.refresh()
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
# Set custom logo
custom_logo_path = resources_path('img', 'logos', 'supporters.png')
report.organisation_logo = custom_logo_path
out_path = unique_filename(
prefix='map_custom_logo_test', suffix='.pdf', dir=temp_dir('test'))
report.print_map_to_pdf(out_path)
# Check the file exists
message = 'Rendered output does not exist: %s' % out_path
self.assertTrue(os.path.exists(out_path), message)
# Check the file is not corrupt
message = 'The output file %s is corrupt' % out_path
out_size = os.stat(out_path).st_size
self.assertTrue(out_size > 0, message)
# Check the organisation logo in composition sets correctly to
# logo-flower
if qgis_version() < 20500:
custom_img_path = report.composition.getComposerItemById(
'organisation-logo').pictureFile()
else:
custom_img_path = report.composition.getComposerItemById(
'organisation-logo').picturePath()
message = 'The custom logo path is not set correctly'
self.assertEqual(custom_logo_path, custom_img_path, message)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:45,代码来源:test_impact_report.py
示例16: test_missing_elements
def test_missing_elements(self):
"""Test missing elements set correctly."""
impact_layer_path = test_data_path(
'impact', 'population_affected_entire_area.shp')
layer, _ = load_layer(impact_layer_path)
template = resources_path(
'qgis-composer-templates', 'a4-portrait-blue.qpt')
report = ImpactReport(IFACE, template, layer)
# There are missing elements in the template
component_ids = ['safe-logo', 'north-arrow', 'organisation-logo',
'impact-map', 'impact-legend',
'i-added-element-id-here-nooo']
report.component_ids = component_ids
expected_missing_elements = ['i-added-element-id-here-nooo']
message = 'The missing_elements should be %s, but it returns %s' % (
report.missing_elements, expected_missing_elements)
self.assertEqual(
expected_missing_elements, report.missing_elements, message)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:19,代码来源:test_impact_report.py
示例17: test_layer_saved_as_without_keywords_and_xml
def test_layer_saved_as_without_keywords_and_xml(self):
"""Check that auxiliary files aren't created when they don't exist.
... and the 'saved as' is used.
"""
layer_path = os.path.join(TESTDATA, 'kecamatan_jakarta_osm.shp')
# pylint: disable=unused-variable
layer, layer_type = load_layer(layer_path)
# pylint: enable=unused-variable
new_name = unique_filename(prefix='kecamatan_jakarta_osm_saved_as')
self.dock.save_auxiliary_files(
layer, join(TESTDATA, '%s.shp' % new_name))
new_xml_file_path = os.path.join(TESTDATA, '%s.xml' % new_name)
message = 'New auxiliary file exist : '
# Will automatically add xml file for the metadata.
self.assertTrue(os.path.isfile(new_xml_file_path), '%s xml' % message)
开发者ID:easmetz,项目名称:inasafe,代码行数:19,代码来源:test_dock.py
示例18: test_layer_saved_as_with_keywords_and_xml
def test_layer_saved_as_with_keywords_and_xml(self):
"""Check that auxiliary files are well copied when they exist and the
'saved as' is used.
"""
layer_path = os.path.join(TESTDATA, 'tsunami_building_assessment.shp')
# pylint: disable=unused-variable
layer, layer_type = load_layer(layer_path)
# pylint: enable=unused-variable
new_name = unique_filename(
prefix='tsunami_building_assessment_saved_as_')
self.dock.save_auxiliary_files(
layer, join(TESTDATA, '%s.shp' % new_name))
new_xml_filepath = os.path.join(TESTDATA, '%s.xml' % new_name)
message = 'New auxiliary file does not exist : '
self.assertTrue(os.path.isfile(new_xml_filepath), '%s xml' % message)
开发者ID:easmetz,项目名称:inasafe,代码行数:19,代码来源:test_dock.py
示例19: test_layer_saved_as_without_keywords_and_xml
def test_layer_saved_as_without_keywords_and_xml(self):
"""Check that auxiliary files aren't created when they don't exist and
the 'saved as' is used.
"""
layer_path = os.path.join(TESTDATA, 'kecamatan_jakarta_osm.shp')
# pylint: disable=unused-variable
layer, layer_type = load_layer(layer_path)
# pylint: enable=unused-variable
new_name = unique_filename(prefix='kecamatan_jakarta_osm_saved_as')
DOCK.save_auxiliary_files(
layer, join(TESTDATA, '%s.shp' % new_name))
new_keywords_filepath = os.path.join(
TESTDATA, '%s.keywords' % new_name)
new_xml_filepath = os.path.join(TESTDATA, '%s.xml' % new_name)
message = 'New auxiliary file exist : '
self.assertFalse(
os.path.isfile(new_keywords_filepath), '%s keywords' % message)
self.assertFalse(os.path.isfile(new_xml_filepath), '%s xml' % message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:21,代码来源:test_dock.py
示例20: test_layer_changed
def test_layer_changed(self):
"""Test the metadata is updated as the user highlights layers.
For inasafe outputs, the table of results should be shown
See also https://github.com/AIFDR/inasafe/issues/58
"""
layer_path = os.path.join(TESTDATA, 'issue58.tif')
layer, layer_type = load_layer(layer_path)
message = (
'Unexpected category for issue58.tif.\nGot:'
' %s\nExpected: undefined' % layer_type)
self.assertTrue(layer_type == 'undefined', message)
self.dock.layer_changed(layer)
self.dock.save_state()
html = self.dock.state['report']
expected = '4229'
message = "%s\nDoes not contain:\n%s" % (
html,
expected)
self.assertTrue(expected in html, message)
开发者ID:lucernae,项目名称:inasafe,代码行数:21,代码来源:test_dock.py
注:本文中的safe.test.utilities.load_layer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论