示例#1
0
 def test_flush(self):
     load_dataset(self.ds)
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 6, resn
     self.ds.flush()
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 0, resn
示例#2
0
 def test_flush(self):
     load_dataset(self.ds)
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 6, resn
     self.ds.flush()
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 0, resn
示例#3
0
 def test_load_all(self):
     load_dataset(self.ds)
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 6, resn
     row0 = resn[0]
     assert row0['amount'] == 200, row0.items()
     assert row0['field'] == 'foo', row0.items()
示例#4
0
 def test_load_all(self):
     load_dataset(self.ds)
     resn = self.engine.execute(self.ds.table.select()).fetchall()
     assert len(resn) == 6, resn
     row0 = resn[0]
     assert row0['amount'] == 200, row0.items()
     assert row0['field'] == 'foo', row0.items()
示例#5
0
 def test_materialize_table(self):
     load_dataset(self.ds)
     itr = self.ds.entries()
     tbl = list(itr)
     assert len(tbl) == 6, len(tbl)
     row = tbl[0]
     assert isinstance(row['field'], unicode), row
     assert isinstance(row['function'], dict), row
     assert isinstance(row['to'], dict), row
示例#6
0
 def test_materialize_table(self):
     load_dataset(self.ds)
     itr = self.ds.entries()
     tbl = list(itr)
     assert len(tbl) == 6, len(tbl)
     row = tbl[0]
     assert isinstance(row['field'], unicode), row
     assert isinstance(row['function'], dict), row
     assert isinstance(row['to'], dict), row
示例#7
0
 def test_aggregate_two_attributes_same_dimension(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function.name', 'function.label'])
     assert len(res['drilldown']) == 2, res['drilldown']
示例#8
0
 def test_aggregate_by_attribute(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function.label'])
     assert len(res['drilldown']) == 2, res['drilldown']
示例#9
0
 def test_aggregate_two_dimensions_drilldown(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function', 'field'])
     assert res['summary']['num_entries'] == 6, res
     assert res['summary']['amount'] == 2690, res
     assert len(res['drilldown']) == 5, res['drilldown']
示例#10
0
 def test_aggregate_or_cut(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(cuts=[('field', u'foo'), ('field', u'bar')])
     assert res['summary']['num_entries'] == 4, res
     assert res['summary']['amount'] == 1190, res
示例#11
0
 def test_aggregate_basic_cut(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(cuts=[('field', u'foo')])
     assert res['summary']['num_entries'] == 3, res
     assert res['summary']['amount'] == 1000, res
示例#12
0
 def test_aggregate_simple(self):
     load_dataset(self.ds)
     res = self.ds.aggregate()
     assert res['summary']['num_entries'] == 6, res
     assert res['summary']['amount'] == 2690.0, res
示例#13
0
 def test_aggregate_simple(self):
     load_dataset(self.ds)
     res = self.ds.aggregate()
     assert res['summary']['num_entries'] == 6, res
     assert res['summary']['amount'] == 2690.0, res
示例#14
0
 def test_aggregate_two_attributes_same_dimension(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function.name', 'function.label'])
     assert len(res['drilldown']) == 2, res['drilldown']
示例#15
0
 def test_aggregate_by_attribute(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function.label'])
     assert len(res['drilldown']) == 2, res['drilldown']
示例#16
0
 def test_aggregate_two_dimensions_drilldown(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(drilldowns=['function', 'field'])
     assert res['summary']['num_entries'] == 6, res
     assert res['summary']['amount'] == 2690, res
     assert len(res['drilldown']) == 5, res['drilldown']
示例#17
0
 def test_aggregate_or_cut(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(cuts=[('field', u'foo'),
                                   ('field', u'bar')])
     assert res['summary']['num_entries'] == 4, res
     assert res['summary']['amount'] == 1190, res
示例#18
0
 def test_aggregate_basic_cut(self):
     load_dataset(self.ds)
     res = self.ds.aggregate(cuts=[('field', u'foo')])
     assert res['summary']['num_entries'] == 3, res
     assert res['summary']['amount'] == 1000, res
示例#19
0
 def test_dataset_count(self):
     load_dataset(self.ds)
     assert len(self.ds) == 6, len(self.ds)
示例#20
0
 def test_dataset_count(self):
     load_dataset(self.ds)
     assert len(self.ds) == 6, len(self.ds)