From 494ab9d4727ff55d8ddb93abad932644c6c95c4a Mon Sep 17 00:00:00 2001 From: Dominik Neise Date: Fri, 4 Oct 2019 10:01:53 +0200 Subject: [PATCH] add dust_gtc to weather --- smart_fact_crawler/__init__.py | 1 + smart_fact_crawler/tests/test_functional.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/smart_fact_crawler/__init__.py b/smart_fact_crawler/__init__.py index dbf1037..a281740 100644 --- a/smart_fact_crawler/__init__.py +++ b/smart_fact_crawler/__init__.py @@ -162,6 +162,7 @@ def weather(url=None, timeout=None, fallback=False): 'wind_gusts': Quantity(s2f(get(table, 8, 1)), 'km/h'), 'wind_direction': get(table, 9, 1), 'dust_tng': Quantity(s2f(get(table, 10, 1)), 'ug/m3'), + 'dust_gtc': Quantity(s2f(get(table, 11, 1)), 'ug/m3'), }) diff --git a/smart_fact_crawler/tests/test_functional.py b/smart_fact_crawler/tests/test_functional.py index abb74ce..9616fb1 100644 --- a/smart_fact_crawler/tests/test_functional.py +++ b/smart_fact_crawler/tests/test_functional.py @@ -1,7 +1,7 @@ from os import path import smart_fact_crawler as sfc from datetime import datetime -from pytest import raises +from pytest import raises, approx test_dir = '2019_10_03_1531/data' @@ -94,3 +94,14 @@ def test_source_name(): assert sfc.current_source().name == 'Park' assert sfc.drive_tracking().source_name == '' + + +def test_weather_gtc_dust(): + sfc.smartfacturl = 'file:' + path.join( + path.dirname(sfc.__file__), + 'resources', + test_dir, + ) + + weather = sfc.weather() + assert weather.dust_gtc.value == approx(19.2, abs=1e-1)