From 5c282017267f31e46a10d335fdc418a0c881d558 Mon Sep 17 00:00:00 2001 From: LeSingh1 Date: Sat, 8 Aug 2026 19:04:35 -0700 Subject: [PATCH] Fix the function name in the get_minimal_required_cuda_ver_from_ptx_ver examples The docstring's Examples section calls get_minimal_required_driver_ver_from_ptx_ver, which exists nowhere in the repo -- the function is get_minimal_required_cuda_ver_from_ptx_ver. The two docstring lines are the only occurrences of the "driver" spelling; the export in utils/__init__.py, tests/test_utils.py, docs/source/module/utils.rst and the release notes all use the "cuda" spelling, so this is a rename that missed its own docstring. The examples are doctests, and they are rendered into the public API docs via autodoc, so users are shown two calls that raise NameError. Nothing caught it because pytest is not run with --doctest-modules. Adds a test that runs doctest.testmod() over the module. It reports 2 failures before this change and 0 after, and needs no GPU or toolkit -- _ptx_utils imports only `re`. --- cuda_bindings/cuda/bindings/utils/_ptx_utils.py | 4 ++-- cuda_bindings/tests/test_utils.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cuda_bindings/cuda/bindings/utils/_ptx_utils.py b/cuda_bindings/cuda/bindings/utils/_ptx_utils.py index 1395fdfd469..ac61524765f 100644 --- a/cuda_bindings/cuda/bindings/utils/_ptx_utils.py +++ b/cuda_bindings/cuda/bindings/utils/_ptx_utils.py @@ -77,9 +77,9 @@ def get_minimal_required_cuda_ver_from_ptx_ver(ptx_version: str) -> int: Examples -------- - >>> get_minimal_required_driver_ver_from_ptx_ver("8.8") + >>> get_minimal_required_cuda_ver_from_ptx_ver("8.8") 12090 - >>> get_minimal_required_driver_ver_from_ptx_ver("7.0") + >>> get_minimal_required_cuda_ver_from_ptx_ver("7.0") 11000 """ try: diff --git a/cuda_bindings/tests/test_utils.py b/cuda_bindings/tests/test_utils.py index c767996bced..20373a2dec7 100644 --- a/cuda_bindings/tests/test_utils.py +++ b/cuda_bindings/tests/test_utils.py @@ -72,6 +72,18 @@ def test_ptx_utils(kernel, actual_ptx_ver, min_cuda_ver): assert cuda_ver == min_cuda_ver +@pytest.mark.agent_authored(model="claude-opus-5") +def test_ptx_utils_docstring_examples(): + """The examples are rendered into the public docs; they have to run.""" + import doctest + + from cuda.bindings.utils import _ptx_utils + + results = doctest.testmod(_ptx_utils, verbose=False, report=False) + assert results.attempted > 0 + assert results.failed == 0 + + @pytest.mark.parametrize( "target", (