@@ -61,6 +61,8 @@ def test_explicit_cast_to_interface():
6161 assert hasattr (i1 , 'SayHello' )
6262 assert i1 .SayHello () == 'hello 1'
6363 assert not hasattr (i1 , 'HelloProperty' )
64+ assert i1 .__implementation__ == ob
65+ assert i1 .__raw_implementation__ == ob
6466
6567 i2 = Test .ISayHello2 (ob )
6668 assert type (i2 ).__name__ == 'ISayHello2'
@@ -76,6 +78,7 @@ def test_interface_object_returned_through_method():
7678 ob = InterfaceTest ()
7779 hello1 = ob .GetISayHello1 ()
7880 assert type (hello1 ).__name__ == 'ISayHello1'
81+ assert hello1 .__implementation__ .__class__ .__name__ == "InterfaceTest"
7982
8083 assert hello1 .SayHello () == 'hello 1'
8184
@@ -107,3 +110,13 @@ def test_interface_array_returned():
107110 ob = InterfaceTest ()
108111 hellos = ob .GetISayHello1Array ()
109112 assert type (hellos [0 ]).__name__ == 'ISayHello1'
113+ assert hellos [0 ].__implementation__ .__class__ .__name__ == "InterfaceTest"
114+
115+ def test_implementation_access ():
116+ """Test the __implementation__ and __raw_implementation__ properties"""
117+ import System
118+ clrVal = System .Int32 (100 )
119+ i = System .IComparable (clrVal )
120+ assert 100 == i .__implementation__
121+ assert clrVal == i .__raw_implementation__
122+ assert i .__implementation__ != i .__raw_implementation__
0 commit comments