From f8bacdcff6f1014e183906c1c668d569a3171e48 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 14 Dec 2020 06:11:10 -0800 Subject: [PATCH] Test for leaving windGustDir=None alone. --- bin/weewx/tests/test_accum.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/bin/weewx/tests/test_accum.py b/bin/weewx/tests/test_accum.py index a82c349a..5b95913e 100644 --- a/bin/weewx/tests/test_accum.py +++ b/bin/weewx/tests/test_accum.py @@ -81,27 +81,20 @@ class StatsTest(unittest.TestCase): self.assertEqual(ss.count, 2 * tcount) def test_null_wind_gust_dir(self): - # If LOOP packets windGustDir=None, the accumulator is supposed to substitute windDir. + # If LOOP packets windGustDir=None, the accumulator should not substitute windDir. # This is a regression test that tests that. accum = weewx.accum.Accum(TimeSpan(start_ts, stop_ts)) - windMax = None - windMaxDir = None # Add the dataset to the accumulator. Null out windGustDir first. for record in self.dataset: record_test = dict(record) record_test['windGustDir'] = None - if windMax is None \ - or (record_test['windSpeed'] is not None - and record_test['windSpeed'] > windMax): - windMax = record_test['windSpeed'] - windMaxDir = record_test['windDir'] accum.addRecord(record_test) # Extract the record out of the accumulator accum_record = accum.getRecord() # windGustDir should match the windDir seen at max wind: - self.assertEqual(accum_record['windGustDir'], windMaxDir) + self.assertIsNone(accum_record['windGustDir']) def test_no_wind_gust_dir(self): # If LOOP packets do not have windGustDir at all, then the accumulator is supposed to