Skip to content

Commit 52d30c5

Browse files
Add test
1 parent 83721b7 commit 52d30c5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎Lib/test/test_clinic.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3739,6 +3739,23 @@ def test_no_change(self):
37393739
# if the content does not change
37403740
self.assertEqual(pre_mtime, post_mtime)
37413741

3742+
def test_warning_is_failure(self):
3743+
code = dedent("""
3744+
/*[clinic input]
3745+
@permit_long_summary
3746+
fn
3747+
3748+
Short summary.
3749+
[clinic start generated code]*/
3750+
""")
3751+
with os_helper.temp_dir() as tmp_dir:
3752+
fn = os.path.join(tmp_dir, "test.c")
3753+
with open(fn, "w", encoding="utf-8") as f:
3754+
f.write(code)
3755+
out, err = self.expect_failure(fn)
3756+
self.assertIn("Remove the @permit_long_summary decorator from 'fn'!", out)
3757+
self.assertEqual(err, "1 warning emitted\n")
3758+
37423759
TOUCH_CODE = dedent("""
37433760
/*[clinic input]
37443761
module m

0 commit comments

Comments
 (0)