summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-04-02 10:09:53 (GMT)
committerGitHub <noreply@github.com>2024-04-02 10:09:53 (GMT)
commit5fd1897ec51cb64ef7990ada538fcd8d9ca1f74b (patch)
tree957892a83948f09e0c094d1714318ce412921977 /Lib/test
parent9dae05ee59eeba0e67af2a46f2a2907c9f8d7e4a (diff)
downloadcpython-5fd1897ec51cb64ef7990ada538fcd8d9ca1f74b.zip
cpython-5fd1897ec51cb64ef7990ada538fcd8d9ca1f74b.tar.gz
cpython-5fd1897ec51cb64ef7990ada538fcd8d9ca1f74b.tar.bz2
gh-113317: Argument Clinic: Add libclinic.converters module (#117315)
Move the following converter classes to libclinic.converters: * PyByteArrayObject_converter * PyBytesObject_converter * Py_UNICODE_converter * Py_buffer_converter * Py_complex_converter * Py_ssize_t_converter * bool_converter * byte_converter * char_converter * defining_class_converter * double_converter * fildes_converter * float_converter * int_converter * long_converter * long_long_converter * object_converter * self_converter * short_converter * size_t_converter * slice_index_converter * str_converter * unicode_converter * unsigned_char_converter * unsigned_int_converter * unsigned_long_converter * unsigned_long_long_converter * unsigned_short_converter Move also the following classes to libclinic.converters: * buffer * robuffer * rwbuffer Move the following functions to libclinic.converters: * correct_name_for_self() * r() * str_converter_key() Move Null and NULL to libclinic.utils.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_clinic.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index f95bf85..a07641d 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -17,6 +17,7 @@ import unittest
test_tools.skip_if_missing('clinic')
with test_tools.imports_under_tool('clinic'):
import libclinic
+ from libclinic.converters import int_converter, str_converter
import clinic
from clinic import DSLParser
@@ -924,7 +925,7 @@ class ClinicParserTest(TestCase):
self.assertEqual(2, len(function.parameters))
p = function.parameters['path']
self.assertEqual('path', p.name)
- self.assertIsInstance(p.converter, clinic.int_converter)
+ self.assertIsInstance(p.converter, int_converter)
def test_param_default(self):
function = self.parse_function("""
@@ -1023,7 +1024,7 @@ class ClinicParserTest(TestCase):
""")
self.assertEqual(3, len(function.parameters))
conv = function.parameters['something_else'].converter
- self.assertIsInstance(conv, clinic.str_converter)
+ self.assertIsInstance(conv, str_converter)
def test_param_default_parameters_out_of_order(self):
err = (
@@ -2040,7 +2041,7 @@ class ClinicParserTest(TestCase):
block = self.parse('module os\nos.access\n path: "s"')
module, function = block.signatures
conv = (function.parameters['path']).converter
- self.assertIsInstance(conv, clinic.str_converter)
+ self.assertIsInstance(conv, str_converter)
def test_legacy_converters_non_string_constant_annotation(self):
err = "Annotations must be either a name, a function call, or a string"