Skip to content

Commit d5bbb36

Browse files
committed
[Python] Replace more equality checks with identity checks
This is continuing the preparation for the more strict comparison operator implementation in cppyy.
1 parent 69b130c commit d5bbb36

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

bindings/pyroot/cppyy/cppyy/test/test_advancedcpp.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ def test09_opaque_pointer_passing(self):
445445
#assert o == cppyy.bind_object(cobj, o.__class__)
446446
#assert o == cppyy.bind_object(cobj, "some_concrete_class")
447447
assert cppyy.addressof(o) == cppyy.addressof(cppyy.bind_object(addr, some_concrete_class))
448-
assert o == cppyy.bind_object(addr, some_concrete_class)
449-
assert o == cppyy.bind_object(addr, type(o))
450-
assert o == cppyy.bind_object(addr, o.__class__)
451-
assert o == cppyy.bind_object(addr, "some_concrete_class")
448+
assert o is cppyy.bind_object(addr, some_concrete_class)
449+
assert o is cppyy.bind_object(addr, type(o))
450+
assert o is cppyy.bind_object(addr, o.__class__)
451+
assert o is cppyy.bind_object(addr, "some_concrete_class")
452452
raises(TypeError, cppyy.bind_object, addr, "does_not_exist")
453453
raises(TypeError, cppyy.bind_object, addr, 1)
454454

@@ -531,13 +531,13 @@ def test12_actual_type(self):
531531
b = base_class()
532532
d = derived_class()
533533

534-
assert b == b.cycle(b)
534+
assert b is b.cycle(b)
535535
assert id(b) == id(b.cycle(b))
536-
assert b == d.cycle(b)
536+
assert b is d.cycle(b)
537537
assert id(b) == id(d.cycle(b))
538-
assert d == b.cycle(d)
538+
assert d is b.cycle(d)
539539
assert id(d) == id(b.cycle(d))
540-
assert d == d.cycle(d)
540+
assert d is d.cycle(d)
541541
assert id(d) == id(d.cycle(d))
542542

543543
assert isinstance(b.cycle(b), base_class)

bindings/pyroot/cppyy/cppyy/test/test_datatypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ def test09_global_ptr(self):
644644

645645
d = gbl.get_global_pod()
646646
assert gbl.is_global_pod(d)
647-
assert c == d
647+
assert c is d
648648
assert id(c) == id(d)
649649

650650
e = gbl.CppyyTestPod()

bindings/pyroot/cppyy/cppyy/test/test_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def test11_cobject_addressing(self):
253253
a = cppyy.gbl.CObjA()
254254
co = cppyy.ll.as_cobject(a)
255255

256-
assert a == cppyy.bind_object(co, 'CObjA')
256+
assert a is cppyy.bind_object(co, 'CObjA')
257257
assert a.m_int == 42
258258
assert cppyy.bind_object(co, 'CObjA').m_int == 42
259259

roottest/python/cpp/PyROOT_cpptests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test12VoidPointerPassing( self ):
229229
self.assertEqual( oaddr, Z.GimeAddressPtrRef( o ) )
230230

231231
pZ = Z.getZ(1)
232-
self.assertEqual( pZ , Z.getZ(1) )
232+
self.assertIs( pZ , Z.getZ(1) )
233233

234234
import array
235235
# Not supported in p2.2

0 commit comments

Comments
 (0)