Testing. RE:#1503

This commit is contained in:
James Douglass 2024-01-23 14:37:35 -08:00
parent 7b840f2589
commit 1f919458bc
2 changed files with 22 additions and 2 deletions

View File

@ -350,8 +350,9 @@ MODEL_SPEC = {
"The average urban nature supply/demand "
"balance available per person within this "
"administrative unit. If no people reside "
"within this administrative unit, this value "
"will be NaN.")
"within this administrative unit, this field "
"will have no value (NaN, NULL or None, "
"depending on your GIS software).")
},
"Pund_adm": {
"type": "number",

View File

@ -937,6 +937,25 @@ class UNATests(unittest.TestCase):
urban_nature_access.execute(args)
summary_vector = gdal.OpenEx(
os.path.join(args['workspace_dir'], 'output',
'admin_boundaries_suffix.gpkg'))
summary_layer = summary_vector.GetLayer()
self.assertEqual(summary_layer.GetFeatureCount(), 1)
summary_feature = summary_layer.GetFeature(1)
expected_field_values = {
'adm_unit_id': 0,
'Pund_adm': 0,
'Povr_adm': 0,
'SUP_DEMadm_cap': None, # OGR converts NaN to None.
}
self.assertEqual(
set(defn.GetName() for defn in summary_layer.schema),
set(expected_field_values.keys()))
for fieldname, expected_value in expected_field_values.items():
self.assertAlmostEqual(
expected_value, summary_feature.GetField(fieldname))
def test_urban_nature_proportion(self):
"""UNA: Run the model with urban nature proportion."""