Skip to content

Commit

Permalink
Using assert_allclose for better numerical comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Oct 16, 2024
1 parent ab90c46 commit 63fb888
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_urban_nature_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def test_split_urban_nature(self):
)
for fieldname, expected_value in expected_values.items():
numpy.testing.assert_allclose(
admin_feature.GetField(fieldname), expected_value)
admin_feature.GetField(fieldname), expected_value, rtol=1e-6)

# The sum of the under-and-oversupplied populations should be equal
# to the total population count.
Expand Down Expand Up @@ -603,8 +603,8 @@ def test_radii_by_pop_group(self):
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))
numpy.testing.assert_allclose(
expected_value, summary_feature.GetField(fieldname), rtol=1e-6)

output_dir = os.path.join(args['workspace_dir'], 'output')
self._assert_urban_nature(os.path.join(
Expand Down Expand Up @@ -679,8 +679,8 @@ def test_radii_by_pop_group_exponential_kernal(self):
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))
numpy.testing.assert_allclose(
expected_value, summary_feature.GetField(fieldname), rtol=1e-6)

output_dir = os.path.join(args['workspace_dir'], 'output')
self._assert_urban_nature(os.path.join(
Expand Down

0 comments on commit 63fb888

Please sign in to comment.