Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e8cd3f

Browse files
committed
fixed conversion tests to match new behavior
1 parentc97e5ab commit2e8cd3f

File tree

6 files changed

+14
-19
lines changed

6 files changed

+14
-19
lines changed

‎tests/test_array.py

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

1010
fromcollectionsimportUserList
11+
fromSystemimportSingleasfloat32
1112

1213

1314
deftest_public_array():
@@ -533,8 +534,8 @@ def test_single_array():
533534
assertitems[0]==0.0
534535
assertitems[4]==4.0
535536

536-
max_=3.402823e38
537-
min_=-3.402823e38
537+
max_=float32(3.402823e38)
538+
min_=float32(-3.402823e38)
538539

539540
items[0]=max_
540541
assertitems[0]==max_
@@ -1291,7 +1292,7 @@ def test_special_array_creation():
12911292

12921293
value=Array[System.Single]([0.0,3.402823e38])
12931294
assertvalue[0]==0.0
1294-
assertvalue[1]==3.402823e38
1295+
assertvalue[1]==System.Single(3.402823e38)
12951296
assertvalue.Length==2
12961297

12971298
value=Array[System.Double]([0.0,1.7976931348623157e308])

‎tests/test_conversion.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,10 @@ def test_single_conversion():
413413
assertob.SingleField==0.0
414414

415415
ob.SingleField=3.402823e38
416-
assertob.SingleField==3.402823e38
416+
assertob.SingleField==System.Single(3.402823e38)
417417

418418
ob.SingleField=-3.402823e38
419-
assertob.SingleField==-3.402823e38
420-
421-
ob.SingleField=System.Single(3.402823e38)
422-
assertob.SingleField==3.402823e38
423-
424-
ob.SingleField=System.Single(-3.402823e38)
425-
assertob.SingleField==-3.402823e38
419+
assertob.SingleField==System.Single(-3.402823e38)
426420

427421
withpytest.raises(TypeError):
428422
ConversionTest().SingleField="spam"

‎tests/test_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_single_field():
300300
assertob.SingleField==0.0
301301

302302
ob.SingleField=1.1
303-
assertob.SingleField==1.1
303+
assertob.SingleField==System.Single(1.1)
304304

305305

306306
deftest_double_field():

‎tests/test_generic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def test_generic_type_binding():
259259
assert_generic_wrapper_by_type(System.UInt16,65000)
260260
assert_generic_wrapper_by_type(System.UInt32,4294967295)
261261
assert_generic_wrapper_by_type(System.UInt64,18446744073709551615)
262-
assert_generic_wrapper_by_type(System.Single,3.402823e38)
262+
assert_generic_wrapper_by_type(System.Single,System.Single(3.402823e38))
263263
assert_generic_wrapper_by_type(System.Double,1.7976931348623157e308)
264264
assert_generic_wrapper_by_type(float,1.7976931348623157e308)
265265
assert_generic_wrapper_by_type(System.Decimal,System.Decimal.One)
@@ -309,7 +309,7 @@ def test_generic_method_type_handling():
309309
assert_generic_method_by_type(System.Int32,2147483647)
310310
assert_generic_method_by_type(int,2147483647)
311311
assert_generic_method_by_type(System.UInt16,65000)
312-
assert_generic_method_by_type(System.Single,3.402823e38)
312+
assert_generic_method_by_type(System.Single,System.Single(3.402823e38))
313313
assert_generic_method_by_type(System.Double,1.7976931348623157e308)
314314
assert_generic_method_by_type(float,1.7976931348623157e308)
315315
assert_generic_method_by_type(System.Decimal,System.Decimal.One)
@@ -504,7 +504,7 @@ def test_method_overload_selection_with_generic_types():
504504
vtype=GenericWrapper[System.Single]
505505
input_=vtype(3.402823e38)
506506
value=MethodTest.Overloaded.__overloads__[vtype](input_)
507-
assertvalue.value==3.402823e38
507+
assertvalue.value==System.Single(3.402823e38)
508508

509509
vtype=GenericWrapper[System.Double]
510510
input_=vtype(1.7976931348623157e308)
@@ -663,7 +663,7 @@ def test_overload_selection_with_arrays_of_generic_types():
663663
vtype=System.Array[gtype]
664664
input_=vtype([gtype(3.402823e38),gtype(3.402823e38)])
665665
value=MethodTest.Overloaded.__overloads__[vtype](input_)
666-
assertvalue[0].value==3.402823e38
666+
assertvalue[0].value==System.Single(3.402823e38)
667667
assertvalue.Length==2
668668

669669
gtype=GenericWrapper[System.Double]

‎tests/test_method.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def test_explicit_overload_selection():
510510
assertvalue==18446744073709551615
511511

512512
value=MethodTest.Overloaded.__overloads__[System.Single](3.402823e38)
513-
assertvalue==3.402823e38
513+
assertvalue==System.Single(3.402823e38)
514514

515515
value=MethodTest.Overloaded.__overloads__[System.Double](
516516
1.7976931348623157e308)
@@ -645,7 +645,7 @@ def test_overload_selection_with_array_types():
645645
input_=vtype([0.0,3.402823e38])
646646
value=MethodTest.Overloaded.__overloads__[vtype](input_)
647647
assertvalue[0]==0.0
648-
assertvalue[1]==3.402823e38
648+
assertvalue[1]==System.Single(3.402823e38)
649649

650650
vtype=Array[System.Double]
651651
input_=vtype([0.0,1.7976931348623157e308])

‎tests/test_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_clr_get_clr_type():
357357
comparable=GetClrType(IComparable)
358358
assertcomparable.FullName=="System.IComparable"
359359
assertcomparable.IsInterface
360-
assertGetClrType(int).FullName=="System.Int32"
360+
assertGetClrType(int).FullName=="Python.Runtime.PyInt"
361361
assertGetClrType(str).FullName=="System.String"
362362
assertGetClrType(float).FullName=="System.Double"
363363
dblarr=System.Array[System.Double]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp