public void TestConvertToInt64()
        {
            var a = new PyLong(5);

            Assert.IsInstanceOf(typeof(long), a.ToInt64());
            Assert.AreEqual(5, a.ToInt64());
        }
        public void TestToInt64()
        {
            long largeNumber   = 8L * 1024L * 1024L * 1024L; // 8 GB
            var  pyLargeNumber = new PyLong(largeNumber);

            Assert.AreEqual(largeNumber, pyLargeNumber.ToInt64());
        }
Пример #3
0
        public static long GetLong(dynamic dynLongPyObj, ref long?longMember)
        {
            if (longMember != null)
            {
                return((long)longMember);
            }

            using (Py.GIL())
            {
                var longPy = new PyLong(dynLongPyObj);
                longMember = longPy.ToInt64();
                return((long)longMember);
            }
        }