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

Method test_param_default_byte_literal

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

Source from the content-addressed store, hash-verified

1176 r'{.buf = " \t\n\r\v\f\240", .obj = NULL, .len = 7}')
1177
1178 def test_param_default_byte_literal(self):
1179 function = self.parse_function(r"""
1180 module test
1181 test.func
1182 zero: char = b'\0'
1183 one: char = b'\1'
1184 lf: char = b'\n'
1185 nbsp: char = b'\xa0'
1186 """)
1187 p = function.parameters['zero']
1188 self.assertEqual(p.default, b'\0')
1189 self.assertEqual(p.converter.py_default, r"b'\x00'")
1190 self.assertEqual(p.converter.c_default, r"'\0'")
1191
1192 p = function.parameters['one']
1193 self.assertEqual(p.default, b'\1')
1194 self.assertEqual(p.converter.py_default, r"b'\x01'")
1195 self.assertEqual(p.converter.c_default, r"'\001'")
1196
1197 p = function.parameters['lf']
1198 self.assertEqual(p.default, b'\n')
1199 self.assertEqual(p.converter.py_default, r"b'\n'")
1200 self.assertEqual(p.converter.c_default, r"'\n'")
1201
1202 p = function.parameters['nbsp']
1203 self.assertEqual(p.default, b'\xa0')
1204 self.assertEqual(p.converter.py_default, r"b'\xa0'")
1205 self.assertEqual(p.converter.c_default, r"'\240'")
1206
1207 def test_param_default_unicode_char(self):
1208 function = self.parse_function(r"""

Callers

nothing calls this directly

Calls 2

parse_functionMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected