public void IsFloatTrue() { const double a = 4.5; var i = new PyFloat(a); Assert.True(PyFloat.IsFloatType(i)); }
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); }
public void StringDoubleCtor() { const string a = "4.5"; var i = new PyFloat(a); Assert.True(PyFloat.IsFloatType(i)); // Assert.Assert.AreEqual(i, a.ToInt32()); }
public void DoubleCtor() { const double a = 4.5; var i = new PyFloat(a); Assert.True(PyFloat.IsFloatType(i)); // Assert.Assert.AreEqual(i, a.ToInt32()); }
public void PyObjectCtorGood() { var i = new PyFloat(5); var a = new PyFloat(i); Assert.True(PyFloat.IsFloatType(a)); // Assert.Assert.AreEqual(i, a.ToInt32()); }
public void FloatCtor() { const float a = 4.5F; var i = new PyFloat(a); Assert.True(PyFloat.IsFloatType(i)); // Assert.Assert.AreEqual(i, a.ToInt32()); }
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()); }
public void IsFloatFalse() { var i = new PyString("Foo"); Assert.False(PyFloat.IsFloatType(i)); }