File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,50 @@ import sys
95
95
else:
96
96
raise AssertionError('Failed to throw exception')
97
97
" ,
98
- }
98
+ } ,
99
+ new TestCase {
100
+ Name = "member_rename" ,
101
+ DotNetBefore = @"
102
+ namespace TestNamespace {
103
+ [System.Serializable]
104
+ public class Cls { public int Before() { return 5; } }
105
+ }" ,
106
+ DotNetAfter = @"
107
+ namespace TestNamespace {
108
+ [System.Serializable]
109
+ public class Cls { public int After() { return 10; } }
110
+ }" ,
111
+ PythonCode = @"
112
+ import clr
113
+ clr.AddReference('DomainTests')
114
+ import TestNamespace
115
+ def before():
116
+ import sys
117
+ sys.my_cls = TestNamespace.Cls
118
+ sys.my_fn = TestNamespace.Cls.Before
119
+ def after():
120
+ import sys
121
+
122
+ # We should have reloaded the class so we can access the new function.
123
+ assert 10 == sys.my_cls.After()
124
+
125
+ try:
126
+ # We should have reloaded the class so we can't access the old function.
127
+ sys.my_cls.Before()
128
+ except AttributeError:
129
+ print('Caught expected AttributeError')
130
+ else:
131
+ raise AssertionError('Failed to throw exception: expected AttributeError accessing class member that no longer exists')
132
+
133
+ try:
134
+ # We should have failed to reload the function which no longer exists.
135
+ sys.my_fn()
136
+ except TypeError:
137
+ print('Caught expected TypeError')
138
+ else:
139
+ raise AssertionError('Failed to throw exception: expected TypeError accessing .NET field that no longer exists')
140
+ " ,
141
+ } ,
99
142
} ;
100
143
101
144
/// <summary>
Original file line number Diff line number Diff line change @@ -14,3 +14,6 @@ def _run_test(testname):
14
14
15
15
def test_rename_class ():
16
16
_run_test ('class_rename' )
17
+
18
+ def test_rename_class_member_function ():
19
+ _run_test ('member_rename' )
You can’t perform that action at this time.
0 commit comments