@@ -45,12 +45,12 @@ static void TupleConversionsGeneric<T, TTuple>()
4545 [ Test ]
4646 public void TupleConversionsObject ( )
4747 {
48- TupleConversionsObject < ValueTuple < int , string , object > , ValueTuple > ( ) ;
48+ TupleConversionsObject < ValueTuple < double , string , object > , ValueTuple > ( ) ;
4949 }
5050 static void TupleConversionsObject < T , TTuple > ( )
5151 {
5252 TupleCodec < TTuple > . Register ( ) ;
53- var tuple = Activator . CreateInstance ( typeof ( T ) , 42 , "42" , new object ( ) ) ;
53+ var tuple = Activator . CreateInstance ( typeof ( T ) , 42.0 , "42" , new object ( ) ) ;
5454 T restored = default ;
5555 using ( var scope = Py . CreateScope ( ) )
5656 {
@@ -66,11 +66,11 @@ static void TupleConversionsObject<T, TTuple>()
6666 [ Test ]
6767 public void TupleRoundtripObject ( )
6868 {
69- TupleRoundtripObject < ValueTuple < int , string , object > , ValueTuple > ( ) ;
69+ TupleRoundtripObject < ValueTuple < double , string , object > , ValueTuple > ( ) ;
7070 }
7171 static void TupleRoundtripObject < T , TTuple > ( )
7272 {
73- var tuple = Activator . CreateInstance ( typeof ( T ) , 42 , "42" , new object ( ) ) ;
73+ var tuple = Activator . CreateInstance ( typeof ( T ) , 42.0 , "42" , new object ( ) ) ;
7474 var pyTuple = TupleCodec < TTuple > . Instance . TryEncode ( tuple ) ;
7575 Assert . IsTrue ( TupleCodec < TTuple > . Instance . TryDecode ( pyTuple , out object restored ) ) ;
7676 Assert . AreEqual ( expected : tuple , actual : restored ) ;
@@ -231,7 +231,7 @@ public void IterableDecoderTest()
231231 //ensure a PyList can be converted to a plain IEnumerable
232232 System . Collections . IEnumerable plainEnumerable1 = null ;
233233 Assert . DoesNotThrow ( ( ) => { codec . TryDecode ( pyList , out plainEnumerable1 ) ; } ) ;
234- CollectionAssert . AreEqual ( plainEnumerable1 , new List < object > { 1 , 2 , 3 } ) ;
234+ CollectionAssert . AreEqual ( plainEnumerable1 . Cast < PyInt > ( ) . Select ( i => i . ToInt32 ( ) ) , new List < object > { 1 , 2 , 3 } ) ;
235235
236236 //can convert to any generic ienumerable. If the type is not assignable from the python element
237237 //it will lead to an empty iterable when decoding. TODO - should it throw?
@@ -271,7 +271,7 @@ public void IterableDecoderTest()
271271 var fooType = foo . GetPythonType ( ) ;
272272 System . Collections . IEnumerable plainEnumerable2 = null ;
273273 Assert . DoesNotThrow ( ( ) => { codec . TryDecode ( pyList , out plainEnumerable2 ) ; } ) ;
274- CollectionAssert . AreEqual ( plainEnumerable2 , new List < object > { 1 , 2 , 3 } ) ;
274+ CollectionAssert . AreEqual ( plainEnumerable2 . Cast < PyInt > ( ) . Select ( i => i . ToInt32 ( ) ) , new List < object > { 1 , 2 , 3 } ) ;
275275
276276 //can convert to any generic ienumerable. If the type is not assignable from the python element
277277 //it will be an exception during TryDecode
0 commit comments