Skip to content

Commit c3d690e

Browse files
committed
gh-107862: Pin gh-160148 as expected-failure examples on the round trip
The folding round-trip strategy cannot produce a well-formed encoded word, because such text is written out verbatim and decoded on reparse (gh-160148), and until now the only record of that in the test was a comment. With example.xfail() in the stubs (gh-160356), three such subjects are now expected-failure examples on the round-trip test, so the test fails again once gh-160148 is resolved and the carve-out can go.
1 parent 5ff6f91 commit c3d690e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎Lib/test/test_email/test_policy.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def test_wide_char_too_long_for_line_does_not_cause_inf_loop(self):
309309
# specials, characters needing 2, 3 and 4 byte UTF-8 encodings, and the
310310
# delimiters of RFC 2047 encoded words. The pieces cannot combine into a
311311
# well-formed encoded word (there is no lone '?'), since such text is
312-
# not encoded and so does not round trip; that is gh-160148.
312+
# written out verbatim and decoded on reparse rather than encoded; that
313+
# is gh-160148, pinned by the expected-failure examples below.
313314
_fold_pieces = hypothesis.strategies.sampled_from([
314315
'a', 'word', 'longwordlongwordlongword', ' ', ' ', '\t', ',', ';',
315316
':', '(', ')', '<', '>', '"', '@', '\\', '.', '-', '_', '\xa0',
@@ -337,6 +338,13 @@ def test_wide_char_too_long_for_line_does_not_cause_inf_loop(self):
337338
@hypothesis.example(subject='word \U0001f600 word', maxlen=0)
338339
@hypothesis.example(subject=' ', maxlen=78)
339340
@hypothesis.example(subject='', maxlen=78)
341+
# gh-160148: text that is itself a well-formed encoded word.
342+
@hypothesis.example(subject='=?utf-8?q?x?=', maxlen=78).xfail(
343+
reason="gh-160148", raises=AssertionError)
344+
@hypothesis.example(subject='=?utf-8?q?x?=)', maxlen=78).xfail(
345+
reason="gh-160148", raises=AssertionError)
346+
@hypothesis.example(subject='=?utf-8?q?x?=\xe9', maxlen=78).xfail(
347+
reason="gh-160148", raises=AssertionError)
340348
def test_fold_unstructured_round_trip(self, subject, maxlen):
341349
policy = email.policy.default.clone(max_line_length=maxlen)
342350
try:

0 commit comments

Comments
 (0)