(self)
| 1242 | (), {}, '', [42]) |
| 1243 | |
| 1244 | def test_basic(self): |
| 1245 | parse = _testcapi.parse_tuple_and_keywords |
| 1246 | |
| 1247 | self.assertEqual(parse((), {'a': 1}, 'O', ['a']), (1,)) |
| 1248 | self.assertEqual(parse((), {}, '|O', ['a']), (NULL,)) |
| 1249 | self.assertEqual(parse((1, 2), {}, 'OO', ['a', 'b']), (1, 2)) |
| 1250 | self.assertEqual(parse((1,), {'b': 2}, 'OO', ['a', 'b']), (1, 2)) |
| 1251 | self.assertEqual(parse((), {'a': 1, 'b': 2}, 'OO', ['a', 'b']), (1, 2)) |
| 1252 | self.assertEqual(parse((), {'b': 2}, '|OO', ['a', 'b']), (NULL, 2)) |
| 1253 | |
| 1254 | with self.assertRaisesRegex(TypeError, |
| 1255 | "function missing required argument 'a'"): |
| 1256 | parse((), {}, 'O', ['a']) |
| 1257 | with self.assertRaisesRegex(TypeError, |
| 1258 | "this function got an unexpected keyword argument 'b'"): |
| 1259 | parse((), {'b': 1}, '|O', ['a']) |
| 1260 | with self.assertRaisesRegex(TypeError, |
| 1261 | fr"argument for function given by name \('a'\) " |
| 1262 | fr"and position \(1\)"): |
| 1263 | parse((1,), {'a': 2}, 'O|O', ['a', 'b']) |
| 1264 | |
| 1265 | def test_bad_use(self): |
| 1266 | # Test handling invalid format and keywords in |
nothing calls this directly
no test coverage detected