Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-mills committed Dec 10, 2024
1 parent ee71bc4 commit 83ab2b2
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 3,896 deletions.
2 changes: 1 addition & 1 deletion .config/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
line-length = 79
line-length = 90
exclude = ["_version.py"]

[lint]
Expand Down
4 changes: 1 addition & 3 deletions src/hdx/scraper/gdacs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def main(

dataset = gdacs.generate_dataset()
dataset.update_from_yaml(
path=join(
dirname(__file__), "config", "hdx_dataset_static.yaml"
)
path=join(dirname(__file__), "config", "hdx_dataset_static.yaml")
)
dataset.create_in_hdx(
remove_additional_resources=True,
Expand Down
2 changes: 1 addition & 1 deletion src/hdx/scraper/gdacs/gdacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_data(self) -> None:
self.dates.append(parse_date(from_date))
self.dates.append(parse_date(to_date))
event_type = entry.gdacs_eventtype
event_type = self._configuration["disaster_conversions"].get(
event_type = self._configuration["disaster_conversion"].get(
event_type, event_type
)
self.data.append(
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/gdacs_rss_information.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id,iso3,country,title,summary,event_type,severity_unit,severity_value,source,from_date,to_date,link,geo_lat,geo_long,gdacs_bbox
#event+id,#country+code,#country+name,#meta+title,#meta+summary,#event+type,#event+severity+unit,#event+severity+value,#meta+source,#date+start,#date+end,#meta+link,#geo+lat,#geo+lon,#geo+bbox
EQ1457082,USA,United States,"Green earthquake alert (Magnitude 5.8M, Depth:28.583km) in United States 10/12/2024 18:04 UTC, Few people affected in 100km.","On 12/10/2024 6:04:35 PM, an earthquake occurred in United States potentially affecting Few people affected in 100km. The earthquake had Magnitude 5.8M, Depth:28.583km.",Earthquake,M,5.8,Joint Research Center of the European Commission,"Tue, 10 Dec 2024 18:04:35 GMT","Tue, 10 Dec 2024 18:04:35 GMT",https://www.gdacs.org/report.aspx?eventtype=EQ&eventid=1457082,51.1125,-177.2133,-181.2133 -173.2133 47.1125 55.1125
EQ1456937,USA,United States,"Green earthquake alert (Magnitude 5.8M, Depth:5km) in United States 09/12/2024 23:08 UTC, Few people affected (in MMI>=VII).","On 12/9/2024 11:08:31 PM, an earthquake occurred in United States potentially affecting Few people affected (in MMI>=VII). The earthquake had Magnitude 5.8M, Depth:5km.",Earthquake,M,5.8,Joint Research Center of the European Commission,"Mon, 09 Dec 2024 23:08:31 GMT","Mon, 09 Dec 2024 23:08:31 GMT",https://www.gdacs.org/report.aspx?eventtype=EQ&eventid=1456937,39.174,-119.0181,-123.0181 -115.0181 35.174 43.174
Loading

0 comments on commit 83ab2b2

Please sign in to comment.