summaryrefslogtreecommitdiff
path: root/tests/gis_tests
diff options
context:
space:
mode:
authorAlexis Athlani <alexis.athlani@gmail.com>2024-01-15 23:16:12 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-16 20:31:46 +0100
commitc7e986fc9f4848bd757d4b9b70a40586d2cee9fb (patch)
tree94e63c995ee4b91f21a1aa6ebc96a704c93b89a1 /tests/gis_tests
parent6debeac9e7538e0e32883dc36abe6fc40a35c874 (diff)
Fixed #35117 -- Added support for the hectare unit in Area.
Diffstat (limited to 'tests/gis_tests')
-rw-r--r--tests/gis_tests/test_measure.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/gis_tests/test_measure.py b/tests/gis_tests/test_measure.py
index 2a922abf9b..19644c1f98 100644
--- a/tests/gis_tests/test_measure.py
+++ b/tests/gis_tests/test_measure.py
@@ -38,6 +38,10 @@ class DistanceTest(SimpleTestCase):
with self.assertRaises(AttributeError):
D(banana=100)
+ def test_init_invalid_area_only_units(self):
+ with self.assertRaises(AttributeError):
+ D(ha=100)
+
def test_access(self):
"Testing access in different units"
d = D(m=100)
@@ -294,6 +298,13 @@ class AreaTest(unittest.TestCase):
self.assertEqual(repr(a1), "Area(sq_m=100.0)")
self.assertEqual(repr(a2), "Area(sq_km=3.5)")
+ def test_hectare(self):
+ a = A(sq_m=10000)
+ self.assertEqual(a.ha, 1)
+
+ def test_hectare_unit_att_name(self):
+ self.assertEqual(A.unit_attname("Hectare"), "ha")
+
def test_hash(self):
a1 = A(sq_m=100)
a2 = A(sq_m=1000000)