simple-dwd-weatherforecast 2.0.22__tar.gz → 2.0.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/PKG-INFO +1 -1
  2. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/setup.py +1 -1
  3. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast/dwdforecast.py +19 -18
  4. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast.egg-info/PKG-INFO +1 -1
  5. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_update.py +59 -28
  6. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/LICENCE +0 -0
  7. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/README.md +0 -0
  8. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/setup.cfg +0 -0
  9. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast/__init__.py +0 -0
  10. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast/dwdmap.py +0 -0
  11. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast/stations.json +0 -0
  12. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast.egg-info/SOURCES.txt +0 -0
  13. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast.egg-info/dependency_links.txt +0 -0
  14. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast.egg-info/requires.txt +0 -0
  15. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/simple_dwd_weatherforecast.egg-info/top_level.txt +0 -0
  16. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/__init__.py +0 -0
  17. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/dummy_data.py +0 -0
  18. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/dummy_data_full.py +0 -0
  19. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_daily_condition.py +0 -0
  20. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_daily_max.py +0 -0
  21. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_daily_min.py +0 -0
  22. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_daily_sum.py +0 -0
  23. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_day_values.py +0 -0
  24. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_forecast_condition.py +0 -0
  25. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_forecast_data.py +0 -0
  26. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_station_name.py +0 -0
  27. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_avg.py +0 -0
  28. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_condition.py +0 -0
  29. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_max.py +0 -0
  30. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_min.py +0 -0
  31. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_sum.py +0 -0
  32. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_get_timeframe_values.py +0 -0
  33. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_is_in_timerange.py +0 -0
  34. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_is_valid_timeframe.py +0 -0
  35. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_location_tools.py +0 -0
  36. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_map.py +0 -0
  37. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_parsekml.py +0 -0
  38. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_region.py +0 -0
  39. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_reported_weather.py +0 -0
  40. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_station.py +0 -0
  41. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_stationsfile.py +0 -0
  42. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_update_hourly.py +0 -0
  43. {simple_dwd_weatherforecast-2.0.22 → simple_dwd_weatherforecast-2.0.23}/tests/test_weather.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple_dwd_weatherforecast
3
- Version: 2.0.22
3
+ Version: 2.0.23
4
4
  Summary: A simple tool to retrieve a weather forecast from DWD OpenData
5
5
  Home-page: https://github.com/FL550/simple_dwd_weatherforecast.git
6
6
  Author: Max Fermor
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="simple_dwd_weatherforecast",
8
- version="2.0.22",
8
+ version="2.0.23",
9
9
  author="Max Fermor",
10
10
  description="A simple tool to retrieve a weather forecast from DWD OpenData",
11
11
  long_description=long_description,
@@ -175,22 +175,22 @@ class Weather:
175
175
  }
176
176
 
177
177
  region_codes = {
178
- "NW": "dweh",
179
- "NI": "dwhg",
180
- "HB": "dwhg",
181
- "SH": "dwhh",
182
- "HH": "dwhh",
183
- "SN": "dwlg",
184
- "ST": "dwlh",
185
- "TH": "dwli",
186
- "BY": "dwmg",
187
- "DW": "dwsg",
188
- "HE": "dwoh",
189
- "RP": "dwoi",
190
- "SL": "dwoi",
191
- "BB": "dwpg",
192
- "BE": "dwpg",
193
- "MV": "dwph",
178
+ "NW": "dweh", # Nordrhein-Westfalen
179
+ "NI": "dwhg", # Niedersachsen
180
+ "HB": "dwhg", # Bremen
181
+ "SH": "dwhh", # Schleswig-Holstein
182
+ "HH": "dwhh", # Hamburg
183
+ "SN": "dwlg", # Sachsen
184
+ "ST": "dwlh", # Sachsen-Anhalt
185
+ "TH": "dwli", # Thueringen
186
+ "BY": "dwmg", # Bayern
187
+ "BW": "dwsg", # Baden-Württemberg
188
+ "HE": "dwoh", # Hessen
189
+ "RP": "dwoi", # Rheinland-Pfalz
190
+ "SL": "dwoi", # Saarland
191
+ "BB": "dwpg", # Brandenburg
192
+ "BE": "dwpg", # Berlin
193
+ "MV": "dwph", # Mecklenburg-Vorpommern
194
194
  }
195
195
 
196
196
  def __init__(self, station_id):
@@ -734,8 +734,9 @@ class Weather:
734
734
  if row[WeatherDataType.VISIBILITY.value[1]] != self.NOT_AVAILABLE
735
735
  else None,
736
736
  WeatherDataType.SUN_IRRADIANCE.value[0]: round(
737
- float(row[WeatherDataType.SUN_IRRADIANCE.value[1]].replace(",", ".")) * 3.6
738
- , 1
737
+ float(row[WeatherDataType.SUN_IRRADIANCE.value[1]].replace(",", "."))
738
+ * 3.6,
739
+ 1,
739
740
  )
740
741
  if row[WeatherDataType.SUN_IRRADIANCE.value[1]] != self.NOT_AVAILABLE
741
742
  else None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple-dwd-weatherforecast
3
- Version: 2.0.22
3
+ Version: 2.0.23
4
4
  Summary: A simple tool to retrieve a weather forecast from DWD OpenData
5
5
  Home-page: https://github.com/FL550/simple_dwd_weatherforecast.git
6
6
  Author: Max Fermor
@@ -13,35 +13,44 @@ class WeatherUpdate(unittest.TestCase):
13
13
  self.dwd_weather.station_name = "BAD HOMBURG"
14
14
 
15
15
  @patch(
16
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
16
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
17
+ return_value=None,
17
18
  )
18
19
  @patch(
19
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
20
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
21
+ return_value=None,
20
22
  )
21
23
  def test_download(self, _1, _2):
22
24
  self.dwd_weather.update()
23
25
  self.assertIsNotNone(self.dwd_weather.forecast_data)
24
26
 
25
27
  @patch(
26
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
28
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
29
+ return_value=None,
27
30
  )
28
31
  @patch(
29
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
32
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
33
+ return_value=None,
30
34
  )
31
35
  @patch(
32
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
36
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
37
+ return_value=None,
33
38
  )
34
39
  def test_issue_time_none(self, mock_function, _1, _2):
35
40
  self.dwd_weather.update()
36
41
  mock_function.assert_called()
42
+
37
43
  @patch(
38
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
44
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
45
+ return_value=None,
39
46
  )
40
47
  @patch(
41
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
48
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
49
+ return_value=None,
42
50
  )
43
51
  @patch(
44
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
52
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
53
+ return_value=None,
45
54
  )
46
55
  def test_issue_time_old(self, mock_function, _1, _2):
47
56
  self.dwd_weather.issue_time = datetime(
@@ -53,13 +62,16 @@ class WeatherUpdate(unittest.TestCase):
53
62
  mock_function.assert_called()
54
63
 
55
64
  @patch(
56
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
65
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
66
+ return_value=None,
57
67
  )
58
68
  @patch(
59
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
69
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
70
+ return_value=None,
60
71
  )
61
72
  @patch(
62
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
73
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
74
+ return_value=None,
63
75
  )
64
76
  @patch(
65
77
  "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
@@ -72,7 +84,7 @@ class WeatherUpdate(unittest.TestCase):
72
84
 
73
85
  class WeatherDownload(unittest.TestCase):
74
86
  @patch(
75
- "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
87
+ "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
76
88
  )
77
89
  def test_etag_valid(self, mock_function):
78
90
  stationid = "H889"
@@ -83,18 +95,20 @@ class WeatherDownload(unittest.TestCase):
83
95
  mock_function.assert_called_once()
84
96
 
85
97
  @patch(
86
- "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
98
+ "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
87
99
  )
88
100
  def test_etag_invalid(self, mock_function):
89
101
  stationid = "H889"
90
102
  self.dwd_weather = dwdforecast.Weather(stationid)
91
103
  self.dwd_weather.etags = {}
92
- self.dwd_weather.etags["https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/{stationid}/kml/MOSMIX_L_LATEST_{stationid}.kmz"] = "invalid_etag"
104
+ self.dwd_weather.etags[
105
+ "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/{stationid}/kml/MOSMIX_L_LATEST_{stationid}.kmz"
106
+ ] = "invalid_etag"
93
107
  self.dwd_weather.download_latest_kml(stationid)
94
108
  mock_function.assert_called()
95
109
 
96
110
  @patch(
97
- "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
111
+ "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
98
112
  )
99
113
  def test_etag_missing(self, mock_function):
100
114
  stationid = "H889"
@@ -104,13 +118,16 @@ class WeatherDownload(unittest.TestCase):
104
118
  mock_function.assert_called()
105
119
 
106
120
  @patch(
107
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
121
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
122
+ return_value=None,
108
123
  )
109
124
  @patch(
110
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
125
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
126
+ return_value=None,
111
127
  )
112
128
  @patch(
113
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
129
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
130
+ return_value=None,
114
131
  )
115
132
  @patch(
116
133
  "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
@@ -121,13 +138,16 @@ class WeatherDownload(unittest.TestCase):
121
138
  mock_download_latest_report.assert_not_called()
122
139
 
123
140
  @patch(
124
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
141
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
142
+ return_value=None,
125
143
  )
126
144
  @patch(
127
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
145
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
146
+ return_value=None,
128
147
  )
129
148
  @patch(
130
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
149
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
150
+ return_value=None,
131
151
  )
132
152
  @patch(
133
153
  "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
@@ -138,13 +158,16 @@ class WeatherDownload(unittest.TestCase):
138
158
  mock_download_latest_report.assert_called()
139
159
 
140
160
  @patch(
141
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
161
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
162
+ return_value=None,
142
163
  )
143
164
  @patch(
144
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
165
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
166
+ return_value=None,
145
167
  )
146
168
  @patch(
147
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
169
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
170
+ return_value=None,
148
171
  )
149
172
  @patch(
150
173
  "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
@@ -156,13 +179,16 @@ class WeatherDownload(unittest.TestCase):
156
179
  mock_download_weather_report.assert_called()
157
180
 
158
181
  @patch(
159
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report", return_value=None
182
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_report",
183
+ return_value=None,
160
184
  )
161
185
  @patch(
162
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report", return_value=None,
186
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_weather_report",
187
+ return_value=None,
163
188
  )
164
189
  @patch(
165
- "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml", return_value=None
190
+ "simple_dwd_weatherforecast.dwdforecast.Weather.download_latest_kml",
191
+ return_value=None,
166
192
  )
167
193
  @patch(
168
194
  "simple_dwd_weatherforecast.dwdforecast.Weather.parse_kml", return_value=None
@@ -171,4 +197,9 @@ class WeatherDownload(unittest.TestCase):
171
197
  self.dwd_weather = dwdforecast.Weather("01008")
172
198
  self.dwd_weather.region = None
173
199
  self.dwd_weather.update()
174
- mock_download_weather_report.assert_not_called()
200
+ mock_download_weather_report.assert_not_called()
201
+
202
+ def test_weather_report_available(self):
203
+ self.dwd_weather = dwdforecast.Weather("10739")
204
+ self.dwd_weather.update(with_report=True)
205
+ self.assertIsNotNone(self.dwd_weather.weather_report)