Skip to content

Commit 932cfb5

Browse files
committed
[Python] More explicit identity comparisons in tests
This follows up on a6e780e, doing the same change for most remaining and uncontroversial cases.
1 parent 5d219af commit 932cfb5

4 files changed

Lines changed: 8 additions & 14 deletions

File tree

bindings/distrdf/test/test_proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def test_node_attr_transformation(self):
136136
]
137137

138138
for attr in node_attributes:
139-
self.assertEqual(getattr(proxy, attr),
140-
getattr(proxy.proxied_node, attr))
139+
self.assertIs(getattr(proxy, attr),
140+
getattr(proxy.proxied_node, attr))
141141

142142
def test_undefined_attr_transformation(self):
143143
"""

roottest/python/basic/PyROOT_datatypetest.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -599,16 +599,14 @@ def test10_global_ptr(self):
599599
d = gbl.get_global_pod()
600600
assert gbl.is_global_pod(d)
601601
assert c == d
602-
# TODO: in PyROOT, non-TObjects are not mem-regulated
603-
#assert id(c) == id(d)
602+
assert c is d
604603

605604
e = gbl.CppyyTestPod()
606605
e.m_int = 43
607606
e.m_double = 2.14
608607

609608
gbl.g_pod = e
610-
# TODO: in PyROOT, non-TObjects are not mem-regulated
611-
#assert gbl.is_global_pod(e)
609+
assert gbl.is_global_pod(e)
612610
assert gbl.g_pod.m_int == 43
613611
assert gbl.g_pod.m_double == 2.14
614612

@@ -892,14 +890,10 @@ def address_equality_test(a, b):
892890
b2 = cppyy.bind_object(a, CppyyTestData)
893891
b.m_int = 888
894892
assert b.m_int == 888
895-
assert b == b2 and b.m_int == b2.m_int
896-
# TODO: in PyROOT, non-TObjects are not mem-regulated
897-
#assert b is b2 # memory regulator recycles
893+
assert b is b2 and b.m_int == b2.m_int
898894
b3 = cppyy.bind_object(cppyy.addressof(a), CppyyTestData)
899895
assert b3.m_int == 888
900-
assert b == b3 and b.m_int == b3.m_int
901-
# TODO: in PyROOT, non-TObjects are not mem-regulated
902-
#assert b is b3 # likewise
896+
assert b is b3 and b.m_int == b3.m_int
903897

904898
address_equality_test(c.m_voidp, c2)
905899
address_equality_test(c.get_voidp(), c2)

roottest/python/cpp/PyROOT_cpptests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test10StaticFunctionCall( self ):
166166

167167
c2 = gROOT.Class()
168168

169-
self.assertEqual( c1, c2 )
169+
self.assertIs( c1, c2 )
170170

171171
old = gROOT.GetDirLevel()
172172
TROOT.SetDirLevel( 2 )

roottest/python/regression/PyROOT_regressiontests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def test1ReuseProxies(self):
524524
a2 = ROOT.A()
525525
a1.otherA = a2
526526
a3 = a1.otherA
527-
self.assertEqual(a3, a2)
527+
self.assertIs(a3, a2)
528528
val = 4
529529
a3.b = val
530530
self.assertEqual(a2.b, val)

0 commit comments

Comments
 (0)