예제 #1
0
        public void IsFloatTrue()
        {
            const double a = 4.5;
            var          i = new PyFloat(a);

            Assert.True(PyFloat.IsFloatType(i));
        }
예제 #2
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);
 }
예제 #3
0
        public void StringDoubleCtor()
        {
            const string a = "4.5";
            var          i = new PyFloat(a);

            Assert.True(PyFloat.IsFloatType(i));
            // Assert.Assert.AreEqual(i, a.ToInt32());
        }
예제 #4
0
        public void DoubleCtor()
        {
            const double a = 4.5;
            var          i = new PyFloat(a);

            Assert.True(PyFloat.IsFloatType(i));
            // Assert.Assert.AreEqual(i, a.ToInt32());
        }
예제 #5
0
        public void PyObjectCtorGood()
        {
            var i = new PyFloat(5);
            var a = new PyFloat(i);

            Assert.True(PyFloat.IsFloatType(a));
            // Assert.Assert.AreEqual(i, a.ToInt32());
        }
예제 #6
0
        public void FloatCtor()
        {
            const float a = 4.5F;
            var         i = new PyFloat(a);

            Assert.True(PyFloat.IsFloatType(i));
            // Assert.Assert.AreEqual(i, a.ToInt32());
        }
예제 #7
0
        public void AsFloatGood()
        {
            const double a = 4.5;
            var          i = new PyFloat(a);
            PyFloat      s = PyFloat.AsFloat(i);

            Assert.True(PyFloat.IsFloatType(s));
            // Assert.Assert.AreEqual(i, a.ToInt32());
        }
예제 #8
0
        public void IsFloatFalse()
        {
            var i = new PyString("Foo");

            Assert.False(PyFloat.IsFloatType(i));
        }