mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
gh-130167: Improve the error case for `textwrap.dedent` (#132666)
This commit is contained in:
parent
c821b715b3
commit
e7c5f60efc
3 changed files with 13 additions and 5 deletions
|
|
@ -765,6 +765,13 @@ def test_subsequent_indent(self):
|
|||
# of IndentTestCase!
|
||||
class DedentTestCase(unittest.TestCase):
|
||||
|
||||
def test_type_error(self):
|
||||
with self.assertRaisesRegex(TypeError, "expected str object, not"):
|
||||
dedent(0)
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "expected str object, not"):
|
||||
dedent(b'')
|
||||
|
||||
def assertUnchanged(self, text):
|
||||
"""assert that dedent() has no effect on 'text'"""
|
||||
self.assertEqual(text, dedent(text))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue