File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1259,7 +1259,7 @@ def test_method_with_pointer_array_argument():
1259
1259
1260
1260
def test_method_call_implicit_conversion ():
1261
1261
1262
- class Answer :
1262
+ class IntAnswerMixin :
1263
1263
# For Python >= 3.8
1264
1264
def __index__ (self ):
1265
1265
return 42
@@ -1268,7 +1268,10 @@ def __index__(self):
1268
1268
def __int__ (self ):
1269
1269
return 42
1270
1270
1271
- class FloatAnswer (Answer ):
1271
+ class Answer (int , IntAnswerMixin ):
1272
+ pass
1273
+
1274
+ class FloatAnswer (float , IntAnswerMixin ):
1272
1275
def __float__ (self ):
1273
1276
return 42.0
1274
1277
@@ -1281,3 +1284,13 @@ def __float__(self):
1281
1284
compare_to = min_value .CompareTo .__overloads__ [t ]
1282
1285
1283
1286
assert compare_to (v ) == - 1
1287
+
1288
+ class SomeNonFloat :
1289
+ def __float__ (self ):
1290
+ return 42.0
1291
+
1292
+ for t in [System .Double , System .Single ]:
1293
+ with pytest .raises (TypeError ):
1294
+ min_value = t (t .MinValue )
1295
+ compare_to = min_value .CompareTo .__overloads__ [t ]
1296
+ assert compare_to (SomeNonFloat ()) == - 1
You can’t perform that action at this time.
0 commit comments