Skip to content

Commit 082d3a7

Browse files
committed
Fix test_methodbinder1
1 parent 2dec272 commit 082d3a7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/core/IronPython/Lib/iptest/test_env.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@
5959
is_net45 = False
6060
is_net45Or46 = False
6161
is_net46 = False
62+
net_version = ()
6263
if is_cli:
6364
if is_netcoreapp: clr.AddReference("System.Runtime.Extensions")
6465
version = System.Environment.Version
66+
net_version = (version.Major, version.Minor)
6567
is_net40 = version.Major == 4
6668
is_net45 = is_net40 and version.Minor == 0 and version.Build == 30319 and version.Revision < 42000
6769
is_net45Or46 = is_net40 and version.Minor == 0 and version.Build == 30319
6870
is_net46 = is_net40 and version.Minor == 0 and version.Build == 30319 and version.Revision == 42000
71+
if is_net45: net_version = (4, 5)
72+
if is_net46: net_version = (4, 6)
6973

7074
#--Newlines
7175
if is_ironpython:

tests/suite/test_methodbinder1.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import unittest
1010

11-
from iptest import IronPythonTestCase, is_mono, is_net70, is_net80, is_netcoreapp, run_test, skipUnlessIronPython
11+
from iptest import IronPythonTestCase, is_mono, is_net60, net_version, is_netcoreapp, run_test, skipUnlessIronPython
1212
from iptest.type_util import *
1313

1414
from System import Int32
@@ -176,7 +176,7 @@ def test_this_matrix(self):
176176

177177

178178

179-
ch2bi = True if is_net70 or is_net80 else TypeE # .NET 7 adds an implicit cast from Char to BigInteger
179+
ch2bi = True if net_version >= (7, 0) else TypeE # .NET 7 adds an implicit cast from Char to BigInteger
180180
################################################## pass in char #########################################################
181181
#### M201 M680 M202 M203 M681 M204 M205 M301 M302 M303 M304 M310 M311 M312 M313 M320 M321 M400
182182
#### int int? double bigint bigint? bool str sbyte i16 i64 single byte ui16 ui32 ui64 char decm obj
@@ -212,7 +212,6 @@ def test_this_matrix(self):
212212
print("TypeE,", end=' ')
213213
except OverflowError:
214214
print("OverF,", end=' ')
215-
print("),")
216215
else:
217216
try:
218217
func(value)
@@ -230,6 +229,8 @@ def test_this_matrix(self):
230229
right = int(funcname[1:])
231230
if left != right:
232231
self.fail("left %s != right %s when func %s on arg %s (%s)\n%s" % (left, right, funcname, scenario[0], type(value), func.__doc__))
232+
if print_the_matrix:
233+
print("),")
233234

234235
# these funcs should behavior same as M201(Int32)
235236
# should have NullableInt too ?

0 commit comments

Comments
 (0)