self.expect_failure(block, err, lineno=6)
def test_directive_preserve_output(self):
- err = "'preserve' only works for blocks that don't produce any output!"
block = dedent("""
/*[clinic input]
output everything buffer
follow_symlinks: bool = True
something_else: str = ''
""")
- p = function.parameters['follow_symlinks']
self.assertEqual(3, len(function.parameters))
conv = function.parameters['something_else'].converter
self.assertIsInstance(conv, clinic.str_converter)
self.assertEqual(repr(clinic.NULL), '<Null>')
# test that fail fails
- expected = (
- 'Error in file "clown.txt" on line 69:\n'
- 'The igloos are melting!\n'
- )
with support.captured_stdout() as stdout:
errmsg = 'The igloos are melting'
with self.assertRaisesRegex(clinic.ClinicError, errmsg) as cm:
exc = cm.exception
self.assertEqual(exc.filename, 'clown.txt')
self.assertEqual(exc.lineno, 69)
+ self.assertEqual(stdout.getvalue(), "")
def test_non_ascii_character_in_docstring(self):
block = """
"not overwriting!")
self.assertIn(expected_err, err)
# Run clinic again, this time with the -f option.
- out = self.expect_success("-f", in_fn)
+ _ = self.expect_success("-f", in_fn)
# Read back the generated output.
with open(in_fn, encoding="utf-8") as f:
data = f.read()