2 from test_support
import run_unittest
4 # The test cases here cover several paths through the function calling
5 # code. They depend on the METH_XXX flag that is used to define a C
6 # function, which can't be verified from Python. If the METH_XXX decl
7 # for a C function changes, these tests may not cover the right paths.
9 class CFunctionCalls(unittest
.TestCase
):
11 def test_varargs0(self
):
12 self
.assertRaises(TypeError, {}.has_key
)
14 def test_varargs1(self
):
17 def test_varargs2(self
):
18 self
.assertRaises(TypeError, {}.has_key
, 0, 1)
20 def test_varargs0_ext(self
):
26 def test_varargs1_ext(self
):
29 def test_varargs2_ext(self
):
37 def test_varargs0_kw(self
):
38 self
.assertRaises(TypeError, {}.has_key
, x
=2)
40 def test_varargs1_kw(self
):
41 self
.assertRaises(TypeError, {}.has_key
, x
=2)
43 def test_varargs2_kw(self
):
44 self
.assertRaises(TypeError, {}.has_key
, x
=2, y
=2)
46 def test_oldargs0_0(self
):
49 def test_oldargs0_1(self
):
50 self
.assertRaises(TypeError, {}.keys
, 0)
52 def test_oldargs0_2(self
):
53 self
.assertRaises(TypeError, {}.keys
, 0, 1)
55 def test_oldargs0_0_ext(self
):
58 def test_oldargs0_1_ext(self
):
66 def test_oldargs0_2_ext(self
):
74 def test_oldargs0_0_kw(self
):
82 def test_oldargs0_1_kw(self
):
83 self
.assertRaises(TypeError, {}.keys
, x
=2)
85 def test_oldargs0_2_kw(self
):
86 self
.assertRaises(TypeError, {}.keys
, x
=2, y
=2)
88 def test_oldargs1_0(self
):
89 self
.assertRaises(TypeError, {}.update
)
91 def test_oldargs1_1(self
):
94 def test_oldargs1_2(self
):
95 self
.assertRaises(TypeError, {}.update
, {}, 1)
97 def test_oldargs1_0_ext(self
):
105 def test_oldargs1_1_ext(self
):
108 def test_oldargs1_2_ext(self
):
116 def test_oldargs1_0_kw(self
):
117 self
.assertRaises(TypeError, {}.update
, x
=2)
119 def test_oldargs1_1_kw(self
):
120 self
.assertRaises(TypeError, {}.update
, {}, x
=2)
122 def test_oldargs1_2_kw(self
):
123 self
.assertRaises(TypeError, {}.update
, x
=2, y
=2)
125 run_unittest(CFunctionCalls
)