Exemplo n.º 1
0
        public void TestPyTupleValidConvert()
        {
            var     l = new PyList();
            PyTuple t = PyTuple.AsTuple(l);

            Assert.IsNotNull(t);
            Assert.IsInstanceOf(typeof(PyTuple), t);
        }
Exemplo n.º 2
0
        public void TestInvalidAsTuple()
        {
            var     i = new PyInt(5);
            PyTuple t = null;

            var ex = Assert.Throws <PythonException>(() => t = PyTuple.AsTuple(i));

            Assert.AreEqual("'int' object is not iterable", ex.Message);
            Assert.IsNull(t);
        }
Exemplo n.º 3
0
        public void TestPyTupleStringConvert()
        {
            PyObject s = new PyString("foo");
            PyTuple  t = PyTuple.AsTuple(s);

            Assert.IsNotNull(t);
            Assert.IsInstanceOf(typeof(PyTuple), t);
            Assert.AreEqual("f", t[0].ToString());
            Assert.AreEqual("o", t[1].ToString());
            Assert.AreEqual("o", t[2].ToString());
        }