Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Pull in main
  • Loading branch information
erlend-aasland committed Aug 15, 2023
commit d50a1e422057fec9e20a75130b544e77e6e8b278
30 changes: 30 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,35 @@ def test_directive_output_invalid_command(self):
"""
self.expect_failure(block, err, lineno=2)

def test_validate_cloned_init(self):
block = """
/*[clinic input]
class C "void *" ""
C.meth
a: int
[clinic start generated code]*/
/*[clinic input]
@classmethod
C.__init__ = C.meth
[clinic start generated code]*/
"""
err = "'__init__' must be a normal method, not a class or static method"
self.expect_failure(block, err, lineno=8)

def test_validate_cloned_new(self):
block = """
/*[clinic input]
class C "void *" ""
C.meth
a: int
[clinic start generated code]*/
/*[clinic input]
C.__new__ = C.meth
[clinic start generated code]*/
"""
err = "'__new__' must be a class method"
self.expect_failure(block, err, lineno=7)

def test_no_c_basename_cloned(self):
block = """
/*[clinic input]
Expand All @@ -625,6 +654,7 @@ def test_no_c_basename_cloned(self):
self.expect_failure(block, err, lineno=5)



class ParseFileUnitTest(TestCase):
def expect_parsing_failure(
self, *, filename, expected_error, verify=True, output=None
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.