File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
namespace Python . Test
2
2
{
3
+ using System ;
3
4
using System . Collections . Generic ;
4
5
5
6
/// <summary>
@@ -26,6 +27,8 @@ public ConversionTest()
26
27
public ulong UInt64Field = 0 ;
27
28
public float SingleField = 0.0F ;
28
29
public double DoubleField = 0.0 ;
30
+ public IntPtr IntPtrField = IntPtr . Zero ;
31
+ public UIntPtr UIntPtrField = UIntPtr . Zero ;
29
32
public decimal DecimalField = 0 ;
30
33
public string StringField ;
31
34
public ShortEnum EnumField ;
@@ -42,7 +45,7 @@ public ConversionTest()
42
45
43
46
}
44
47
45
-
48
+
46
49
47
50
public interface ISpam
48
51
{
@@ -63,7 +66,7 @@ public string GetValue()
63
66
return value ;
64
67
}
65
68
}
66
-
69
+
67
70
public class UnicodeString
68
71
{
69
72
public string value = "안녕" ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def test_bool_conversion():
25
25
26
26
with pytest .raises (TypeError ):
27
27
ob .BooleanField = 1
28
-
28
+
29
29
with pytest .raises (TypeError ):
30
30
ob .BooleanField = 0
31
31
@@ -679,3 +679,20 @@ def test_iconvertible_conversion():
679
679
assert 1024 == change_type (1024 , System .Int32 )
680
680
assert 1024 == change_type (1024 , System .Int64 )
681
681
assert 1024 == change_type (1024 , System .Int16 )
682
+
683
+ def test_intptr_conversion ():
684
+ from System import IntPtr , UIntPtr , Int64
685
+
686
+ ob = ConversionTest ()
687
+
688
+ assert ob .IntPtrField == IntPtr .Zero
689
+ assert ob .UIntPtrField == UIntPtr .Zero
690
+
691
+ ob .IntPtrField = IntPtr (- 1 )
692
+ assert ob .IntPtrField == IntPtr (- 1 )
693
+
694
+ ob .IntPtrField = IntPtr (Int64 (1024 ))
695
+ assert ob .IntPtrField == IntPtr (1024 )
696
+
697
+ ob .UIntPtrField = ob .IntPtrField
698
+ assert ob .UIntPtrField == UIntPtr (1024 )
You can’t perform that action at this time.
0 commit comments