From 3a3151eecd0c0a41fa88413c558728fa5390a8e0 Mon Sep 17 00:00:00 2001 From: Famlam Date: Sun, 4 Aug 2024 14:28:27 +0200 Subject: [PATCH] Fix: combined ft in wasn't detected anymore Previous to #2280 the use of `ftin` was reported by class 3091. This detection got lost in that PR. This fix just returns the unit for feet as it was given as input, hence enabling the detection again (in the new class 30915) --- plugins/Number.py | 2 +- plugins/modules/units.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Number.py b/plugins/Number.py index 9fa3e281f..8d1fde9e5 100644 --- a/plugins/Number.py +++ b/plugins/Number.py @@ -172,7 +172,7 @@ def test(self): assert not a.node(None, {"maxspeed":d}), ("maxspeed='{0}'".format(d)) assert not a.node(None, {"minspeed:forward":d}), ("minspeed:forward='{0}'".format(d)) - for d in ["50 millimeters", "40 metre", "30 feet", "30 in", "10 mile"]: + for d in ["50 millimeters", "40 metre", "30 feet", "30 in", "10 mile", "6ft 6in"]: self.check_err(a.node(None, {"distance": d}), ("distance='{0}'".format(d))) assert not a.node(None, {"maxspeed":"1", "waterway": "river"}) diff --git a/plugins/modules/units.py b/plugins/modules/units.py index dbb777538..5a1a204be 100644 --- a/plugins/modules/units.py +++ b/plugins/modules/units.py @@ -52,7 +52,7 @@ def parseNumberUnitString(string, defaultUnit = None): if m: return { "value": float(m.group(1) + m.group(2)) + float(m.group(1) + m.group(4))/12, - "unit": "'" + "unit": m.group(3) } # Regular numbers with optional unit m = re.fullmatch(_numunit_re, string)