Skip to content

Commit

Permalink
Add DOT travel tests (#1848)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbowen-usds committed Sep 14, 2022
1 parent eea77c2 commit f455a98
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
GEOID10_TRACT,DOT Travel Barriers Score
06061021322,52.3684736425
06069000802,67.6807523475
15001021101,65.6905624925
15001021800,64.6348560575
15007040603,47.3085751425
15007040604,48.7634318775
15007040700,56.8031262775
15009030201,64.1950173025
15009030402,50.2530948600
15009030800,56.1490333775
15001021010,69.4901838075
15001021402,53.4854747375
15003010201,54.7191133125
15009030100,37.8950511525
06027000800,38.5533081475

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import geopandas as gpd
import pathlib
from data_pipeline.tests.sources.example.test_etl import TestETL
from data_pipeline.etl.sources.dot_travel_composite.etl import (
TravelCompositeETL,
)


class TestTravelCompositeETL(TestETL):
_ETL_CLASS = TravelCompositeETL

_SAMPLE_DATA_PATH = pathlib.Path(__file__).parents[0] / "data"
_SAMPLE_DATA_FILE_NAME = "DOT_Disadvantage_Layer_Final_April2022.shp"
_SAMPLE_DATA_ZIP_FILE_NAME = "Shapefile_and_Metadata.zip"
_EXTRACT_TMP_FOLDER_NAME = "TravelCompositeETL"

def setup_method(self, _method, filename=__file__):
"""Invoke `setup_method` from Parent, but using the current file name.
This code can be copied identically between all child classes.
"""
super().setup_method(_method=_method, filename=filename)

def test_extract_produces_valid_data(self, snapshot, mock_etl, mock_paths):
etl = self._setup_etl_instance_and_run_extract(
mock_etl=mock_etl,
mock_paths=mock_paths,
)
tmp_df = gpd.read_file(
etl.get_tmp_path() / self._SAMPLE_DATA_FILE_NAME,
dtype={etl.GEOID_TRACT_FIELD_NAME: str},
)
assert tmp_df.shape[0] >= 15
assert tmp_df.shape[1] >= 86

0 comments on commit f455a98

Please sign in to comment.