Ejemplo n.º 1
0
 def test_tobject_formatter_tprofile(self):
     """Should successfully return a TProfile representation."""
     rep = response_formatters.tobject_formatter(self.tprofile)
     exp = dict(
         success=True,
         data=dict(
             name='test_tprofile',
             title='Test TProfile',
             object_class='TProfile',
             data=response_formatters.th1_formatter(self.tprofile)
         )
     )
     self.assertEqual(rep, exp)
 def test_tobject_formatter_tprofile(self):
     """Should successfully return a TProfile representation."""
     rep = response_formatters.tobject_formatter(self.tprofile)
     exp = dict(
         success=True,
         data=dict(
             name='test_tprofile',
             title='Test TProfile',
             object_class='TProfile',
             data=response_formatters.th1_formatter(self.tprofile)
         )
     )
     self.assertEqual(rep, exp)
Ejemplo n.º 3
0
 def test_th1_formatter(self):
     """Should correctly format a TH1 dictionary representation."""
     rep = response_formatters.th1_formatter(self.th1)
     exp = dict(
         entries=self.th1.GetEntries(),
         mean=self.th1.GetMean(),
         rms=self.th1.GetRMS(),
         underflow=1.0,
         overflow=2.0,
         binning=[(0.0, 0.5), (0.5, 1.0)],
         values=[4.0, 9.0],
         uncertainties=[(sqrt(4), sqrt(4)), (sqrt(9), sqrt(9))],
         axis_titles=('Foo', 'Bar')
     )
     self.assertEqual(rep, exp)
 def test_th1_formatter(self):
     """Should correctly format a TH1 dictionary representation."""
     rep = response_formatters.th1_formatter(self.th1)
     exp = dict(
         entries=self.th1.GetEntries(),
         mean=self.th1.GetMean(),
         rms=self.th1.GetRMS(),
         underflow=1.0,
         overflow=2.0,
         binning=[(0.0, 0.5), (0.5, 1.0)],
         values=[4.0, 9.0],
         uncertainties=[(sqrt(4), sqrt(4)), (sqrt(9), sqrt(9))],
         axis_titles=('Foo', 'Bar')
     )
     self.assertEqual(rep, exp)