MCPcopy Index your code
hub / github.com/python/cpython / test_param_default_bool

Method test_param_default_bool

Lib/test/test_clinic.py:1242–1263  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1240 self.assertEqual(p.converter.c_default, '0x1f40d')
1241
1242 def test_param_default_bool(self):
1243 function = self.parse_function(r"""
1244 module test
1245 test.func
1246 bool: bool = True
1247 intbool: bool(accept={int}) = True
1248 intbool2: bool(accept={int}) = 2
1249 """)
1250 p = function.parameters['bool']
1251 self.assertIs(p.default, True)
1252 self.assertEqual(p.converter.py_default, 'True')
1253 self.assertEqual(p.converter.c_default, '1')
1254
1255 p = function.parameters['intbool']
1256 self.assertIs(p.default, True)
1257 self.assertEqual(p.converter.py_default, 'True')
1258 self.assertEqual(p.converter.c_default, '1')
1259
1260 p = function.parameters['intbool2']
1261 self.assertEqual(p.default, 2)
1262 self.assertEqual(p.converter.py_default, '2')
1263 self.assertEqual(p.converter.c_default, '2')
1264
1265 def test_param_default_expr_named_constant(self):
1266 function = self.parse_function("""

Callers

nothing calls this directly

Calls 3

parse_functionMethod · 0.95
assertIsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected