mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-112205: Require @getter and @setter to be methods (#113278)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
e51b400945
commit
6a69b80d1b
2 changed files with 15 additions and 0 deletions
|
@ -2249,6 +2249,17 @@ class ClinicParserTest(TestCase):
|
|||
expected_error = "Cannot apply both @getter and @setter to the same function!"
|
||||
self.expect_failure(block, expected_error, lineno=3)
|
||||
|
||||
def test_getset_no_class(self):
|
||||
for annotation in "@getter", "@setter":
|
||||
with self.subTest(annotation=annotation):
|
||||
block = f"""
|
||||
module m
|
||||
{annotation}
|
||||
m.func
|
||||
"""
|
||||
expected_error = "@getter and @setter must be methods"
|
||||
self.expect_failure(block, expected_error, lineno=2)
|
||||
|
||||
def test_duplicate_coexist(self):
|
||||
err = "Called @coexist twice"
|
||||
block = """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue