codecov-io: # [Codecov](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=h1) Report
> Merging [#68](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=desc) into [master](https://codecov.io/gh/python-metar/python-metar/commit/f092a1bf3a8b35a0366b6c5f42fe8fea6bdba093?src=pr&el=desc) will **increase** coverage by `2.28%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/python-metar/python-metar/pull/68/graphs/tree.svg?width=650&token=W7CMdTTvRY&height=150&src=pr)](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
+ Coverage   72.88%   75.17%   +2.28%     
==========================================
  Files           4        4              
  Lines        1018     1019       +1     
==========================================
+ Hits          742      766      +24     
+ Misses        276      253      -23
```


| [Impacted Files](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [metar/Metar.py](https://codecov.io/gh/python-metar/python-metar/pull/68/diff?src=pr&el=tree#diff-bWV0YXIvTWV0YXIucHk=) | `69.95% <100%> (+3.65%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=footer). Last update [f092a1b...cdceeb0](https://codecov.io/gh/python-metar/python-metar/pull/68?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

coveralls: ## Pull Request Test Coverage Report for [Build 62](https://coveralls.io/builds/19177547)

* **4** of **4**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage increased (+**2.3%**) to **75.172%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/19177547/badge)](https://coveralls.io/builds/19177547) |
| :-- | --: |
| Change from base [Build 61](https://coveralls.io/builds/19169388): |  2.3% |
| Covered Lines: | 766 |
| Relevant Lines: | 1019 |

---
##### 💛  - [Coveralls](https://coveralls.io)

diff --git a/metar/Metar.py b/metar/Metar.py
index 7cbcaac..7d5c0a7 100755
--- a/metar/Metar.py
+++ b/metar/Metar.py
@@ -649,7 +649,7 @@ class Metar(object):
             high = distance(d['high'], unit)
         self.runway.append([d['name'], low, high, unit])
 
-    def _handleWeather( self, d ):
+    def _handleWeather(self, d):
         """
         Parse a present-weather group.
 
@@ -668,7 +668,7 @@ class Metar(object):
         preci = d['prec']
         obsci = d['obsc']
         otheri = d['other']
-        self.weather.append((inteni,desci,preci,obsci,otheri))
+        self.weather.append((inteni, desci, preci, obsci, otheri))
 
     def _handleSky( self, d ):
         """
@@ -1200,7 +1200,7 @@ class Metar(object):
         """
         text_list = []
         for weatheri in weather:
-            (inteni,desci,preci,obsci,otheri) = weatheri
+            (inteni, desci, preci, obsci, otheri) = weatheri
             text_parts = []
             code_parts = []
             if inteni:
@@ -1223,6 +1223,8 @@ class Metar(object):
                     precip_text = WEATHER_PREC[preci[:2]]+", "
                     precip_text += WEATHER_PREC[preci[2:4]]+" and "
                     precip_text += WEATHER_PREC[preci[4:]]
+                else:
+                    precip_text = preci
                 if desci == "TS":
                     text_parts.append("with")
                 text_parts.append(precip_text)

local variable 'precip_text' referenced before assignment in present_weather output
Automatic report could broke the present weather output.

 This METAR : 
`METAR FSIA 220100Z AUTO 14014KT 120V180 9999 ///////// 27/23 Q1010`

gives an error when the method present_weather is triggered: 
```
UnboundLocalError: local variable 'precip_text' referenced before assignment
```

diff --git a/test/test_metar.py b/test/test_metar.py
index 5482a03..05392a6 100644
--- a/test/test_metar.py
+++ b/test/test_metar.py
@@ -30,6 +30,15 @@ class MetarTest(unittest.TestCase):
         )
         self.assertEqual(res, ans)
 
+    def test_issue67_precip_text(self):
+        """Check that precip_text is properly defined in present_weather."""
+        report = Metar.Metar(
+            "METAR FSIA 220100Z AUTO 14014KT 120V180 9999 ///////// "
+            "27/23 Q1010"
+        )
+        res = report.present_weather()
+        self.assertEqual(res, "/////////")
+
     def test_issue40_runwayunits(self):
         """Check reported units on runway visual range."""
         report = Metar.Metar(

pip install -e .
parse_log_pytest
pytest
pytest
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/python-metar/python-metar.git@dfdc565b2e7a7aed8c14c0c6faec16a3113a931e#egg=metar
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: python-metar
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/python-metar

test/test_metar.py::MetarTest::test_issue67_precip_text
test/test_metar.py::MetarTest::test_010_parseType_default test/test_metar.py::MetarTest::test_011_parseType_legal test/test_metar.py::MetarTest::test_020_parseStation_legal test/test_metar.py::MetarTest::test_021_parseStation_illegal test/test_metar.py::MetarTest::test_030_parseTime_legal test/test_metar.py::MetarTest::test_031_parseTime_specify_year test/test_metar.py::MetarTest::test_032_parseTime_specify_month test/test_metar.py::MetarTest::test_033_parseTime_auto_month test/test_metar.py::MetarTest::test_034_parseTime_auto_year test/test_metar.py::MetarTest::test_035_parseTime_suppress_auto_month test/test_metar.py::MetarTest::test_040_parseModifier_default test/test_metar.py::MetarTest::test_041_parseModifier test/test_metar.py::MetarTest::test_042_parseModifier_nonstd test/test_metar.py::MetarTest::test_043_parseModifier_illegal test/test_metar.py::MetarTest::test_140_parseWind test/test_metar.py::MetarTest::test_141_parseWind_nonstd test/test_metar.py::MetarTest::test_142_parseWind_illegal test/test_metar.py::MetarTest::test_150_parseVisibility test/test_metar.py::MetarTest::test_151_parseVisibility_direction test/test_metar.py::MetarTest::test_152_parseVisibility_with_following_temperature test/test_metar.py::MetarTest::test_290_ranway_state test/test_metar.py::MetarTest::test_300_parseTrend test/test_metar.py::MetarTest::test_310_parse_sky_conditions test/test_metar.py::MetarTest::test_issue40_runwayunits test/test_metar.py::MetarTest::test_issue51_strict test/test_metar.py::MetarTest::test_issue64_cloudkeyerror test/test_metar.py::MetarTest::test_not_strict_mode test/test_metar.py::MetarTest::test_snowdepth
metar/Metar.py
metar/Metar.py