def test_tobject_formatter_th2(self): """Should successfully return a TH1 representation.""" rep = response_formatters.tobject_formatter(self.th2) exp = dict( success=True, data=dict( name='test_th2f', title='Test TH2F', object_class='TH2F', data=response_formatters.th2_formatter(self.th2) ) ) self.assertEqual(rep, exp)
def test_th2_formatter(self): """Should correctly format a TH2 dictionary representation.""" rep = response_formatters.th2_formatter(self.th2) exp = dict( entries=self.th2.GetEntries(), mean=self.th2.GetMean(), rms=self.th2.GetRMS(), xbinning=[(0.0, 0.5), (0.5, 1.0)], ybinning=[(0.0, 0.5), (0.5, 1.0)], values=[[4.0, 9.0], [4.0, 1.0]], axis_titles=('Foo', 'Bar') ) self.assertEqual(rep, exp)
def test_th2_formatter(self): """Should correctly format a TH2 dictionary representation.""" rep = response_formatters.th2_formatter(self.th2) exp = dict( entries=self.th2.GetEntries(), mean=self.th2.GetMean(), rms=self.th2.GetRMS(), xbinning=[(0.0, 0.5), (0.5, 1.0)], ybinning=[(0.0, 0.5), (0.5, 1.0)], values=[[4.0, 9.0], [4.0, 1.0]], xunderflow=(1.0 + 2 + 9 + 10), yunderflow=(5.0 + 6 + 9 + 12), xoverflow=(3.0 + 4 + 11 + 12), yoverflow=(7.0 + 8 + 10 + 11), axis_titles=('Foo', 'Bar', 'Baz') ) self.maxDiff = None self.assertEqual(rep, exp)