from test
import test_support
# The test cases here cover several paths through the function calling
# code. They depend on the METH_XXX flag that is used to define a C
# function, which can't be verified from Python. If the METH_XXX decl
# for a C function changes, these tests may not cover the right paths.
class CFunctionCalls(unittest
.TestCase
):
self
.assertRaises(TypeError, {}.has_key
)
self
.assertRaises(TypeError, {}.has_key
, 0, 1)
def test_varargs0_ext(self
):
def test_varargs1_ext(self
):
def test_varargs2_ext(self
):
def test_varargs0_kw(self
):
self
.assertRaises(TypeError, {}.has_key
, x
=2)
def test_varargs1_kw(self
):
self
.assertRaises(TypeError, {}.has_key
, x
=2)
def test_varargs2_kw(self
):
self
.assertRaises(TypeError, {}.has_key
, x
=2, y
=2)
def test_oldargs0_0(self
):
def test_oldargs0_1(self
):
self
.assertRaises(TypeError, {}.keys
, 0)
def test_oldargs0_2(self
):
self
.assertRaises(TypeError, {}.keys
, 0, 1)
def test_oldargs0_0_ext(self
):
def test_oldargs0_1_ext(self
):
def test_oldargs0_2_ext(self
):
def test_oldargs0_0_kw(self
):
def test_oldargs0_1_kw(self
):
self
.assertRaises(TypeError, {}.keys
, x
=2)
def test_oldargs0_2_kw(self
):
self
.assertRaises(TypeError, {}.keys
, x
=2, y
=2)
def test_oldargs1_0(self
):
self
.assertRaises(TypeError, [].count
)
def test_oldargs1_1(self
):
def test_oldargs1_2(self
):
self
.assertRaises(TypeError, [].count
, 1, 2)
def test_oldargs1_0_ext(self
):
def test_oldargs1_1_ext(self
):
def test_oldargs1_2_ext(self
):
def test_oldargs1_0_kw(self
):
self
.assertRaises(TypeError, [].count
, x
=2)
def test_oldargs1_1_kw(self
):
self
.assertRaises(TypeError, [].count
, {}, x
=2)
def test_oldargs1_2_kw(self
):
self
.assertRaises(TypeError, [].count
, x
=2, y
=2)
test_support
.run_unittest(CFunctionCalls
)
if __name__
== "__main__":