コード例 #1
0
 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'])
コード例 #2
0
ファイル: test_operations.py プロジェクト: www3838438/fireant
 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'], {})
コード例 #3
0
 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')],
             ))
コード例 #4
0
 def test_totals_init(self):
     totals = Totals('date')
     self.assertEqual('totals', totals.key)