Пример #1
0
 public static object ToCLI(this PyObject o)
 {
     if (PySequence.IsSequenceType(o))
     {
         var list = new List <object>();
         foreach (PyObject subo in o)
         {
             list.Add(subo.ToCLI());
         }
         return(list);
     }
     if (PyString.IsStringType(o))
     {
         return(o.As <string>());
     }
     if (PyInt.IsIntType(o))
     {
         return(o.As <long>());
     }
     if (PyLong.IsLongType(o))
     {
         return(o.As <long>());
     }
     if (PyFloat.IsFloatType(o))
     {
         return(o.As <double>());
     }
     return(o);
 }
Пример #2
0
        public void TestIsSequenceFalse()
        {
            var t = new PyInt(5);

            Assert.False(PySequence.IsSequenceType(t));
        }
Пример #3
0
        public void TestIsSequenceTrue()
        {
            var t = new PyString("FooBar");

            Assert.True(PySequence.IsSequenceType(t));
        }