Fixed #30341 -- Added support for the furlong unit in Distance.
This commit is contained in:
parent
753580ecd1
commit
49fb3f5f3e
|
@ -233,6 +233,7 @@ class Distance(MeasureBase):
|
|||
'clarke_link': 0.201166195164,
|
||||
'fathom': 1.8288,
|
||||
'ft': 0.3048,
|
||||
'furlong': 201.168,
|
||||
'german_m': 1.0000135965,
|
||||
'gold_coast_ft': 0.304799710181508,
|
||||
'indian_yd': 0.914398530744,
|
||||
|
@ -280,6 +281,7 @@ class Distance(MeasureBase):
|
|||
'Chain (Benoit)': 'chain_benoit',
|
||||
'Chain (Sears)': 'chain_sears',
|
||||
'Foot (International)': 'ft',
|
||||
'Furrow Long': 'furlong',
|
||||
'German legal metre': 'german_m',
|
||||
'Gold Coast foot': 'gold_coast_ft',
|
||||
'Indian yard': 'indian_yd',
|
||||
|
|
|
@ -93,6 +93,7 @@ Unit Attribute Full name or alias(es)
|
|||
``clarke_link`` Clarke's link
|
||||
``fathom`` Fathom
|
||||
``rod`` Rod
|
||||
``furlong`` Furlong, Furrow Long
|
||||
``nm`` Nautical Mile
|
||||
``nm_uk`` Nautical Mile (UK)
|
||||
``german_m`` German legal metre
|
||||
|
|
|
@ -75,6 +75,9 @@ Minor features
|
|||
* Added the :class:`~django.contrib.gis.db.models.functions.GeometryDistance`
|
||||
function, supported on PostGIS.
|
||||
|
||||
* Added support for the ``furlong`` unit in
|
||||
:class:`~django.contrib.gis.measure.Distance`.
|
||||
|
||||
:mod:`django.contrib.messages`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -138,10 +138,15 @@ class DistanceTest(unittest.TestCase):
|
|||
self.assertEqual(repr(d1), 'Distance(m=100.0)')
|
||||
self.assertEqual(repr(d2), 'Distance(km=3.5)')
|
||||
|
||||
def test_furlong(self):
|
||||
d = D(m=201.168)
|
||||
self.assertEqual(d.furlong, 1)
|
||||
|
||||
def test_unit_att_name(self):
|
||||
"Testing the `unit_attname` class method"
|
||||
unit_tuple = [('Yard', 'yd'), ('Nautical Mile', 'nm'), ('German legal metre', 'german_m'),
|
||||
('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain')]
|
||||
('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain'),
|
||||
('Furrow Long', 'furlong')]
|
||||
for nm, att in unit_tuple:
|
||||
with self.subTest(nm=nm):
|
||||
self.assertEqual(att, D.unit_attname(nm))
|
||||
|
|
Loading…
Reference in New Issue