Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de3874c

Browse files
committed
Add PyTuple Ctor tests
1 parent 305040d commit de3874c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/embed_tests/TestPyTuple.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,42 @@ public void TestPyTupleBadCtor()
5858
}
5959
}
6060

61+
[Test]
62+
public void TestPyTupleCtorEmptyArray()
63+
{
64+
using (Py.GIL())
65+
{
66+
var a = new PyObject[] { };
67+
var t = new PyTuple(a);
68+
69+
Assert.AreEqual(0, t.Length());
70+
}
71+
}
72+
73+
[Test]
74+
public void TestPyTupleCtorArrayPyIntEmpty()
75+
{
76+
using (Py.GIL())
77+
{
78+
var a = new PyInt[] { };
79+
var t = new PyTuple(a);
80+
81+
Assert.AreEqual(0, t.Length());
82+
}
83+
}
84+
85+
[Test]
86+
public void TestPyTupleCtorArray()
87+
{
88+
using (Py.GIL())
89+
{
90+
var a = new PyObject[] {new PyInt(1), new PyString("Foo") };
91+
var t = new PyTuple(a);
92+
93+
Assert.AreEqual(2, t.Length());
94+
}
95+
}
96+
6197
/// <summary>
6298
/// Test PyTuple.Concat(...) doesn't let invalid appends happen
6399
/// and throws and exception.

0 commit comments

Comments
 (0)