From 5bd752f53ee7b1f1363e9670cedcfeb73c2936d3 Mon Sep 17 00:00:00 2001 From: Tomas R Date: Thu, 1 Feb 2024 12:49:01 +0100 Subject: [PATCH] gh-107461 ctypes: Add a testcase for nested `_as_parameter_` lookup (GH-107462) (cherry picked from commit 0bf42dae7e73febc76ea96fd58af6b765a12b8a7) Co-authored-by: Tomas R --- Lib/test/test_ctypes/test_as_parameter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Lib/test/test_ctypes/test_as_parameter.py b/Lib/test/test_ctypes/test_as_parameter.py index 36fec572b16741..27a5d3ac06430b 100644 --- a/Lib/test/test_ctypes/test_as_parameter.py +++ b/Lib/test/test_ctypes/test_as_parameter.py @@ -227,5 +227,16 @@ class AsParamPropertyWrapperTestCase(BasicWrapTestCase): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class AsParamNestedWrapperTestCase(BasicWrapTestCase): + """Test that _as_parameter_ is evaluated recursively. + + The _as_parameter_ attribute can be another object which + defines its own _as_parameter_ attribute. + """ + + def wrap(self, param): + return AsParamWrapper(AsParamWrapper(AsParamWrapper(param))) + + if __name__ == '__main__': unittest.main()