Skip to content

Commit f2d5ae2

Browse files
test: name the literal-character test for what it exercises
`test_a_unicode_escape_becomes_its_character` fed a literal e-acute rather than a backslash-u escape spelling one, so it passed against the unfixed writer and proved nothing about the escape form its name claimed. `TestTheWriterResolvesUnicodeEscapes` already covers both escape forms, so rename this one to say what it does test -- that a non-ASCII character written literally survives the trip into a heredoc body -- and point the newer class's docstring at it rather than at "the earlier test".
1 parent 388b69c commit f2d5ae2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/unit/test_template_spans.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _body(self, value: str) -> str:
9595
def test_a_tab_becomes_a_tab(self):
9696
self.assertEqual(self._body(r'"a\tb\n"'), "a = <<EOF\na\tb\nEOF\n")
9797

98-
def test_a_unicode_escape_becomes_its_character(self):
98+
def test_a_literal_non_ascii_character_survives(self):
9999
self.assertEqual(self._body(r'"café\n"'), "a = <<EOF\ncafé\nEOF\n")
100100

101101
def test_a_wide_unicode_escape_becomes_its_character(self):
@@ -263,7 +263,11 @@ def test_characters_left_unescaped_are_legal_as_themselves(self):
263263

264264

265265
class TestTheWriterResolvesUnicodeEscapes(TestCase):
266-
r"""The earlier test used a literal e-acute, which passes without the fix."""
266+
r"""`\uNNNN` and `\UNNNNNNNN`, written as escapes rather than as the character.
267+
268+
`TestTheWriterResolvesEveryEscape` covers a literal non-ASCII character, which
269+
the writer passed through even before it resolved the escape forms.
270+
"""
267271

268272
def test_a_bmp_escape_becomes_its_character(self):
269273
source = '"' + chr(92) + "u00e9" + chr(92) + "n" + '"'

0 commit comments

Comments
 (0)