def test_data_query_schema__totals_dim_set_in_rollup(self): query_schema = self.test_slicer.manager.data_query_schema( metrics=['foo', 'bar'], dimensions=['dim'], operations=[Totals('dim')], ) self.assertListEqual(query_schema['rollup'], ['dim'])
def test_totals_display_schema__no_extra_metrics_selected(self): display_schema = self.test_slicer.manager.display_schema( metrics=['foo', 'bar'], dimensions=['dim'], operations=[Totals('dim')]) self.assertDictEqual(display_schema['metrics'], { 'foo': { 'label': 'foo', 'axis': 0 }, 'bar': { 'label': 'bar', 'axis': 1 } }) self.assertDictEqual(display_schema['dimensions'], { 'dim': { 'label': 'dim', 'display_options': { np.nan: '', pd.NaT: '' } } }) self.assertDictEqual(display_schema['references'], {})
def test_data_query_schema__exception_when_missing_totals_dim(self): with self.assertRaises(SlicerException): print( self.test_slicer.manager.data_query_schema( metrics=['foo', 'bar'], dimensions=[], operations=[Totals('dim')], ))
def test_totals_init(self): totals = Totals('date') self.assertEqual('totals', totals.key)