Skip to content

Commit

Permalink
Add output-path tests (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbowen-usds committed Aug 2, 2022
1 parent 349604d commit 1c8282b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ def test_init(self, mock_etl, mock_paths):
assert etl.HEALTHY_FOOD_INPUT_FIELD == "HE_FOOD"
assert etl.IMPENETRABLE_SURFACES_INPUT_FIELD == "HE_GREEN"
assert etl.READING_INPUT_FIELD == "ED_READING"

def test_get_output_file_path(self, mock_etl, mock_paths):
"""Tests the right file name is returned."""
etl = self._ETL_CLASS()
data_path, tmp_path = mock_paths

output_file_path = etl._get_output_file_path()
expected_output_file_path = (
data_path / "dataset" / "child_opportunity_index" / "usa.csv"
)
assert output_file_path == expected_output_file_path
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestDOEEnergyBurdenETL(TestETL):
This uses pytest-snapshot.
To update individual snapshots: $ poetry run pytest
data_pipeline/tests/sources/ndoe_energy_burden/test_etl.py::TestClassNameETL::<testname>
data_pipeline/tests/sources/doe_energy_burden/test_etl.py::TestClassNameETL::<testname>
--snapshot-update
"""

Expand Down Expand Up @@ -48,3 +48,14 @@ def test_init(self, mock_etl, mock_paths):
assert etl.INPUT_GEOID_TRACT_FIELD_NAME == "FIP"
assert etl.INPUT_ENERGY_BURDEN_FIELD_NAME == "BURDEN"
assert etl.REVISED_ENERGY_BURDEN_FIELD_NAME == "Energy burden"

def test_get_output_file_path(self, mock_etl, mock_paths):
"""Tests the right file name is returned."""
etl = self._ETL_CLASS()
data_path, tmp_path = mock_paths

output_file_path = etl._get_output_file_path()
expected_output_file_path = (
data_path / "dataset" / "doe_energy_burden" / "usa.csv"
)
assert output_file_path == expected_output_file_path
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# pylint: disable=protected-access
from unittest import mock
import pathlib
import requests
from data_pipeline.etl.base import ValidGeoLevel

from data_pipeline.etl.sources.national_risk_index.etl import (
Expand Down

0 comments on commit 1c8282b

Please sign in to comment.