mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-107880: Teach Argument Clinic to clone __init__ and __new__ methods (#107885)
This commit is contained in:
parent
7ddc1eaff1
commit
9b75ada6e4
5 changed files with 244 additions and 8 deletions
|
@ -2973,6 +2973,17 @@ class ClinicFunctionalTest(unittest.TestCase):
|
|||
ac_tester.DeprStarNew(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_new_cloned(self):
|
||||
regex = re.escape(
|
||||
"Passing positional arguments to _testclinic.DeprStarNew.cloned() "
|
||||
"is deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14."
|
||||
)
|
||||
obj = ac_tester.DeprStarNew(a=None)
|
||||
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
|
||||
obj.cloned(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_init(self):
|
||||
regex = re.escape(
|
||||
"Passing positional arguments to _testclinic.DeprStarInit() is "
|
||||
|
@ -2983,6 +2994,17 @@ class ClinicFunctionalTest(unittest.TestCase):
|
|||
ac_tester.DeprStarInit(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_init_cloned(self):
|
||||
regex = re.escape(
|
||||
"Passing positional arguments to _testclinic.DeprStarInit.cloned() "
|
||||
"is deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14."
|
||||
)
|
||||
obj = ac_tester.DeprStarInit(a=None)
|
||||
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
|
||||
obj.cloned(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_pos0_len1(self):
|
||||
fn = ac_tester.depr_star_pos0_len1
|
||||
fn(a=None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue