mirror of
https://github.com/weewx/weewx.git
synced 2026-06-10 01:55:07 -04:00
Fixed problem when one of the trend values is None.
Regression test in test suites.
This commit is contained in:
@@ -440,7 +440,10 @@ class TrendObj(object):
|
||||
# F_to_C(68F - 50F). We want the former, not the latter.
|
||||
now_vtc = self.converter.convert(now_vt)
|
||||
then_vtc = self.converter.convert(then_vt)
|
||||
trend = now_vtc - then_vtc
|
||||
if now_vtc.value is None or then_vtc.value is None:
|
||||
trend = ValueTuple(None, now_vtc.unit, now_vtc.group)
|
||||
else:
|
||||
trend = now_vtc - then_vtc
|
||||
|
||||
# Return the results as a ValueHelper. Use the formatting and labeling
|
||||
# options from the current time record. The user can always override
|
||||
|
||||
@@ -91,6 +91,10 @@
|
||||
<td>Outside Temperature trend with explicit time_delta (3600 seconds)</td>
|
||||
<td>4.4°F</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Outside Temperature trend where previous value is known to be None (9000 seconds)</td>
|
||||
<td> N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trend with nonsense type</td>
|
||||
<td>?'foobar'?</td>
|
||||
|
||||
@@ -91,6 +91,10 @@
|
||||
<td>Outside Temperature trend with explicit time_delta (3600 seconds)</td>
|
||||
<td>2.4°C</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Outside Temperature trend where previous value is known to be None (9000 seconds)</td>
|
||||
<td> N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trend with nonsense type</td>
|
||||
<td>?'foobar'?</td>
|
||||
|
||||
@@ -98,6 +98,11 @@
|
||||
<td>Outside Temperature trend with explicit time_delta (3600 seconds)</td>
|
||||
<td>$trend($time_delta=3600).outTemp</td>
|
||||
</tr>
|
||||
<tr>
|
||||
## This test uses a previous value known to be None:
|
||||
<td>Outside Temperature trend where previous value is known to be None (9000 seconds)</td>
|
||||
<td>$trend($time_delta=9000).outTemp</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Trend with nonsense type</td>
|
||||
<td>$trend.foobar</td>
|
||||
|
||||
Reference in New Issue
Block a user