コード例 #1
0
        public void TestPyTupleCtorArray()
        {
            var a = new PyObject[] { new PyInt(1), new PyString("Foo") };
            var t = new PyTuple(a);

            Assert.AreEqual(2, t.Length());
        }
コード例 #2
0
        public void TestPyTupleCtorArrayPyIntEmpty()
        {
            var a = new PyInt[] { };
            var t = new PyTuple(a);

            Assert.AreEqual(0, t.Length());
        }
コード例 #3
0
        public void TestPyTupleCtorEmptyArray()
        {
            var a = new PyObject[] { };
            var t = new PyTuple(a);

            Assert.AreEqual(0, t.Length());
        }
コード例 #4
0
 public void TestPyTupleEmpty()
 {
     using (Py.GIL())
     {
         var t = new PyTuple();
         Assert.AreEqual(0, t.Length());
     }
 }
コード例 #5
0
        public void TestPyTupleInvalidAppend()
        {
            PyObject s = new PyString("foo");
            var      t = new PyTuple();

            var ex = Assert.Throws <PythonException>(() => t.Concat(s));

            StringAssert.StartsWith("can only concatenate tuple", ex.Message);
            Assert.AreEqual(0, t.Length());
            Assert.IsEmpty(t);
        }