Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bindings/distrdf/test/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def test_node_attr_transformation(self):
]

for attr in node_attributes:
self.assertEqual(getattr(proxy, attr),
getattr(proxy.proxied_node, attr))
self.assertIs(getattr(proxy, attr),
getattr(proxy.proxied_node, attr))

def test_undefined_attr_transformation(self):
"""
Expand Down
15 changes: 13 additions & 2 deletions bindings/pyroot/pythonizations/test/roofit.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
a = ROOT.RooRealVar("a", "", 0)
b = ROOT.RooRealVar("b", "", 0)

l = collection_class(a, b)

Check failure on line 43 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E741)

bindings/pyroot/pythonizations/test/roofit.py:43:9: E741 Ambiguous variable name: `l`

it = iter(l)

Expand All @@ -64,19 +64,30 @@
self.assertTrue(var0 in coll)
self.assertTrue("var0" in coll)

self.assertTrue(not var1 in coll)

Check failure on line 67 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E713)

bindings/pyroot/pythonizations/test/roofit.py:67:29: E713 Test for membership should be `not in` help: Convert to `not in`
self.assertTrue(not "var1" in coll)

Check failure on line 68 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E713)

bindings/pyroot/pythonizations/test/roofit.py:68:29: E713 Test for membership should be `not in` help: Convert to `not in`

self.assertTrue(var2 in coll)
self.assertTrue(not "var2" in coll)

Check failure on line 71 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E713)

bindings/pyroot/pythonizations/test/roofit.py:71:29: E713 Test for membership should be `not in` help: Convert to `not in`

# ensure consistency with RooAbsCollection::find
variables = [var0, var1, var2]

for i, vptr in enumerate(variables):
vname = "var" + str(i)
self.assertEqual(coll.find(vptr) == vptr, vptr in coll)
self.assertEqual(coll.find(vname) == vptr, vname in coll)

found_by_ptr = coll.find(vptr)
found_by_name = coll.find(vname)

# To ensure comparing objects of equal type also when it can't
# auto-downcast because the object was not found in the collection:
if found_by_ptr == ROOT.nullptr:
found_by_ptr = ROOT.BindObject(found_by_ptr, vptr.IsA().GetName())
if found_by_name == ROOT.nullptr:
found_by_name = ROOT.BindObject(found_by_name, vptr.IsA().GetName())

self.assertEqual(found_by_ptr == vptr, vptr in coll)
self.assertEqual(found_by_name == vptr, vname in coll)

def _test_getitem(self, collection_class):

Expand Down Expand Up @@ -235,8 +246,8 @@
def test_frame(self):
# test that kwargs can be passed
# and lead to correct result
r1 = self.gauss.plotOn(self.xframe, ROOT.RooFit.LineColor(ROOT.kRed))

Check failure on line 249 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:249:9: F841 Local variable `r1` is assigned to but never used help: Remove assignment to unused variable `r1`
r2 = self.gauss.plotOn(self.xframe, LineColor=ROOT.kRed)

Check failure on line 250 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:250:9: F841 Local variable `r2` is assigned to but never used help: Remove assignment to unused variable `r2`

def test_wrong_kwargs(self):
# test that AttributeError is raised
Expand All @@ -248,15 +259,15 @@
# as doing the same plot with passed ROOT objects
dtframe = self.x.frame(ROOT.RooFit.Range(-5, 5), ROOT.RooFit.Title("dt distribution with custom binning"))
binning = ROOT.RooBinning(20, -5, 5)
r1 = self.data.plotOn(dtframe, ROOT.RooFit.Binning(binning))

Check failure on line 262 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:262:9: F841 Local variable `r1` is assigned to but never used help: Remove assignment to unused variable `r1`
r2 = self.data.plotOn(dtframe, Binning=binning)

Check failure on line 263 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:263:9: F841 Local variable `r2` is assigned to but never used help: Remove assignment to unused variable `r2`

def test_data(self):
# test that no error is causes if python style and cpp style
# args are provided to plotOn and that results are identical
frame = self.x.frame(ROOT.RooFit.Name("xframe"), ROOT.RooFit.Title("Red Curve"), ROOT.RooFit.Bins(20))
res1_d1 = self.data.plotOn(frame, ROOT.RooFit.DataError(ROOT.RooAbsData.SumW2))

Check failure on line 269 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:269:9: F841 Local variable `res1_d1` is assigned to but never used help: Remove assignment to unused variable `res1_d1`
res2_d1 = self.data.plotOn(frame, DataError=ROOT.RooAbsData.SumW2)

Check failure on line 270 in bindings/pyroot/pythonizations/test/roofit.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F841)

bindings/pyroot/pythonizations/test/roofit.py:270:9: F841 Local variable `res2_d1` is assigned to but never used help: Remove assignment to unused variable `res2_d1`


class TestRooArgList(unittest.TestCase):
Expand Down
14 changes: 4 additions & 10 deletions roottest/python/basic/PyROOT_datatypetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,14 @@ def test10_global_ptr(self):
d = gbl.get_global_pod()
assert gbl.is_global_pod(d)
assert c == d
# TODO: in PyROOT, non-TObjects are not mem-regulated
#assert id(c) == id(d)
assert c is d

e = gbl.CppyyTestPod()
e.m_int = 43
e.m_double = 2.14

gbl.g_pod = e
# TODO: in PyROOT, non-TObjects are not mem-regulated
#assert gbl.is_global_pod(e)
assert gbl.is_global_pod(e)
assert gbl.g_pod.m_int == 43
assert gbl.g_pod.m_double == 2.14

Expand Down Expand Up @@ -892,14 +890,10 @@ def address_equality_test(a, b):
b2 = cppyy.bind_object(a, CppyyTestData)
b.m_int = 888
assert b.m_int == 888
assert b == b2 and b.m_int == b2.m_int
# TODO: in PyROOT, non-TObjects are not mem-regulated
#assert b is b2 # memory regulator recycles
assert b is b2 and b.m_int == b2.m_int
b3 = cppyy.bind_object(cppyy.addressof(a), CppyyTestData)
assert b3.m_int == 888
assert b == b3 and b.m_int == b3.m_int
# TODO: in PyROOT, non-TObjects are not mem-regulated
#assert b is b3 # likewise
assert b is b3 and b.m_int == b3.m_int

address_equality_test(c.m_voidp, c2)
address_equality_test(c.get_voidp(), c2)
Expand Down
2 changes: 1 addition & 1 deletion roottest/python/cpp/PyROOT_cpptests.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test10StaticFunctionCall( self ):

c2 = gROOT.Class()

self.assertEqual( c1, c2 )
self.assertIs( c1, c2 )

old = gROOT.GetDirLevel()
TROOT.SetDirLevel( 2 )
Expand Down
2 changes: 1 addition & 1 deletion roottest/python/regression/PyROOT_regressiontests.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def test1ReuseProxies(self):
a2 = ROOT.A()
a1.otherA = a2
a3 = a1.otherA
self.assertEqual(a3, a2)
self.assertIs(a3, a2)
val = 4
a3.b = val
self.assertEqual(a2.b, val)
Expand Down
Loading