def test_source(self): ar_downsample._loadAR() sess = Session(client=app.test_client()) output_server('Census', session=sess) source = ServerDataSource(expr={ 'op': 'Field', 'args': [':leaf', 'bivariate'] }) plot = figure() plot.square('A', 'B', source=source) agg = ar_downsample.CountCategories() info = ar_downsample.Const(val=1) shader = ar_downsample.InterpolateColor() new_source = ar_downsample.source(plot, agg=agg, info=info, shader=shader) self.assertIsNotNone(new_source.transform) trans = new_source.transform self.assertEquals(trans['resample'], 'abstract rendering') self.assertEquals(trans['agg'], agg) self.assertEquals(trans['info'], info) self.assertEquals(trans['shader'], shader) self.assertEquals(trans['glyphspec'], plot.select({'type': GlyphRenderer})[0].glyph) self.assertEquals(trans['points'], False)
def test_aggregators(self): aggregators = [(ar_downsample.Sum(), numeric.Sum, {}), (ar_downsample.Count(), numeric.Count, {}), (ar_downsample.CountCategories(), categories.CountCategories, {})] for (agg, target, kwargs) in aggregators: self._reify_tester(agg, target, kwargs)
def test_source(self): ar_downsample._loadAR() source = ServerDataSource(data_url="fn://bivariate", owner_username="******") plot = figure() plot.square('A', 'B', source=source) agg = ar_downsample.CountCategories() info = ar_downsample.Const(val=1) shader = ar_downsample.InterpolateColor() new_source = ar_downsample.source(plot, agg=agg, info=info, shader=shader) self.assertIsNotNone(new_source.transform) trans = new_source.transform self.assertEquals(trans['resample'], 'abstract rendering') self.assertEquals(trans['agg'], agg) self.assertEquals(trans['info'], info) self.assertEquals(trans['shader'], shader) self.assertEquals(trans['glyphspec'], self._glyphspec(plot)) self.assertEquals(trans['points'], False)