@@ -313,6 +313,36 @@ def test_statistics_slice(self, hist_setup):
313
313
assert hist_setup .GetStdDev () == pytest .approx (sliced_hist .GetStdDev (), rel = 10e-5 )
314
314
assert hist_setup .GetMean () == pytest .approx (sliced_hist .GetMean (), rel = 10e-5 )
315
315
316
+ def test_equality_operator (self , hist_setup ):
317
+ if _special_setting (hist_setup ) or isinstance (hist_setup , (ROOT .TH1C , ROOT .TH2C , ROOT .TH3C )):
318
+ pytest .skip ("This feature cannot be tested here" )
319
+
320
+ assert hist_setup == hist_setup [...]
321
+
322
+ cloned_histograms = {
323
+ "content" : hist_setup .Clone (),
324
+ "error" : hist_setup .Clone (),
325
+ "weight" : hist_setup .Clone (),
326
+ "axis" : hist_setup .Clone (),
327
+ }
328
+ assert all (hist_setup == other for other in cloned_histograms .values ())
329
+
330
+ # Change the content of a bin
331
+ cloned_histograms ["content" ].SetBinContent (1 , 100 )
332
+ assert hist_setup != cloned_histograms ["content" ]
333
+
334
+ # Change the error of a bin
335
+ cloned_histograms ["error" ].SetBinError (1 , 10 )
336
+ assert hist_setup != cloned_histograms ["error" ]
337
+
338
+ # Change the weight of a bin
339
+ cloned_histograms ["weight" ].AddBinContent (1 , 100 )
340
+ assert hist_setup != cloned_histograms ["weight" ]
341
+
342
+ # Change the x axis
343
+ cloned_histograms ["axis" ].GetXaxis ().Set (10 , 1 , 5 )
344
+ assert hist_setup != cloned_histograms ["axis" ]
345
+
316
346
317
347
if __name__ == "__main__" :
318
348
pytest .main (args = [__file__ ])
0 commit comments