def test_different_call_days_format(self): """ Test whether we can pass different call days format such as table name, SQL query and CallDays class. """ cd = CallDays("2016-01-01", "2016-01-04", level="versioned-site") har = HartiganCluster(cd, 50).get_dataframe() self.assertIsInstance(har, pd.DataFrame) cd.store().result() har = HartiganCluster(Table(cd.table_name), 50).get_dataframe() self.assertIsInstance(har, pd.DataFrame) cd_query = cd.get_query() har = HartiganCluster(CustomQuery(cd_query), 50).get_dataframe() self.assertIsInstance(har, pd.DataFrame)
def test_different_call_days_format(get_dataframe): """ Test whether we can pass different call days format such as table name, SQL query and CallDays class. """ cd = CallDays( SubscriberLocations("2016-01-01", "2016-01-04", spatial_unit=make_spatial_unit("versioned-site"))) har = get_dataframe(HartiganCluster(calldays=cd, radius=50)) assert isinstance(har, pd.DataFrame) cd.store().result() har = get_dataframe( HartiganCluster(calldays=Table(cd.fully_qualified_table_name), radius=50)) assert isinstance(har, pd.DataFrame) cd_query = cd.get_query() har = get_dataframe( HartiganCluster(calldays=CustomQuery(cd_query, cd.column_names), radius=50)) assert isinstance(har, pd.DataFrame)