def test_get_quantiles_check_receive_time(self, prepare_data_file): """Check that get_quantiles function returns expected result for receive_time field """ data_frame = phout.parse_phout(prepare_data_file) quantiles = phout.get_quantiles(data_frame, 'receive_time') quantiles['receive_time'] = quantiles['receive_time'].astype(int) assert quantiles['receive_time'].values.tolist() == [ 13, 14, 14, 16, 18, 19, 21, 28, 41, 41, 41, 41, 41 ], "unexpected quantiles values"
def test_get_quantiles_check_default_quantile_list(self, prepare_data_file): """Check that get_quantiles function returns expected result for default quantile_list """ data_frame = phout.parse_phout(prepare_data_file) quantiles = phout.get_quantiles(data_frame, 'interval_real') assert quantiles['quantile'].values.tolist() == [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.98, 0.99, 1 ], "unexpected default quantile_list values"
def test_get_quantiles_empty_data(self, remove_data_file): """Check that get_quantiles function returns expected result for receive_time field """ filename = remove_data_file() self.set_phout_file(filename, []) data_frame = phout.parse_phout(filename) quantiles = phout.get_quantiles(data_frame, 'receive_time') quantiles['receive_time'] = quantiles['receive_time'].fillna(0).astype( int) assert quantiles['receive_time'].values.tolist() == [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "quantiles should consist of 0 values"
def test_get_quantiles_latency(self, prepare_data_file): """Check that get_quantiles function returns expected result for latency field """ data_frame = phout.parse_phout(prepare_data_file) quantiles = phout.get_quantiles(data_frame, 'latency') # check index assert quantiles['quantile'].values.tolist() == [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.98, 0.99, 1 ], "unexpected quantiles values" # check latency quantiles['latency'] = quantiles['latency'].fillna(0).astype(int) assert quantiles['latency'].values.tolist() == [ 4549, 4575, 4699, 4947, 5135, 5240, 5394, 5612, 5744, 5764, 5776, 5780, 5785 ], "unexpected quantiles values"