Skip to content

gh-113317: Argument Clinic: Add libclinic.converters module #117315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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

Expand Down Expand Up @@ -909,7 +910,7 @@ def test_param(self):
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("""
Expand Down Expand Up @@ -1008,7 +1009,7 @@ def test_param_no_docstring(self):
""")
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 = (
Expand Down Expand Up @@ -2025,7 +2026,7 @@ def test_legacy_converters(self):
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"
Expand Down
Loading
Loading