def test_series_basic(): df = get_housing_df_for_region('we', csv_dir='test/data') series_builder = HousingSeriesBuilder(df) series = series_builder.build() assert len(series.index) == len(df.index)
def test_series_two_filters(): df = get_housing_df_for_region('we', csv_dir='test/data') series_builder = HousingSeriesBuilder(df) series = series_builder.build(start_date=201511, end_date=201511) assert len(series.index) < len(df.index)
def test_place_info_lookup_index(): df = get_housing_df_for_region('we', csv_dir='test/data') registry = HousingDFRegistry() registry.add(df, 'we') place_info = PlaceInfo(registry, sample_date=201510) place_info.build() ind = place_info.df.index[0] assert len(place_info.df.loc[ind]['Place Name']) > 0
def test_place_info(): df = get_housing_df_for_region('we', csv_dir='test/data') registry = HousingDFRegistry() registry.add(df, 'we') place_info = PlaceInfo(registry, sample_date=201510) place_info.build() assert len( place_info.df[place_info.df['Place Name'] == 'San Francisco']) == 1
def test_place_df(): df = get_housing_df_for_region('we', csv_dir='test/data') place_df = PlaceDF(df, 'Seattle') assert len(place_df.df[place_df.df['Place Name'] == 'San Francisco']) == 0 assert np.all(place_df.df['Place Name'] == 'Seattle')
def test_get_housing_df_for_region_yearly(): df = get_housing_df_for_region('we', csv_dir='test/data', from_yearly_data=True) assert len(df[df['Place Name'] == 'San Francisco']) > 0
def test_get_housing_df_for_region(): df = get_housing_df_for_region('we', csv_dir='test/data') assert len(df[df['Place Name'] == 'San Francisco']) > 0