Repository navigation
Commit ab96b89
committed
gh-107862: Pin the known codec failures as expected-failure examples
Previously each known bug had its own expectedFailure test generating
only the failing inputs. Hypothesis already has a way to say that: an
`@example(...).xfail(reason=..., raises=...)` on the test the input
belongs to, which is strict in both Hypothesis and (after gh-160356) the
stubs. Each bug is now a few such examples on test_decode_in_chunks,
test_encode_in_chunks, test_encode_decode or test_reader_matches_decode,
and the carve-outs in the strategies point at them.
Also from review:
- MULTIBYTE_ENCODINGS is an issubclass check against
_multibytecodec.MultibyteIncrementalDecoder rather than a look at the
repr of the MRO.
- Only raw_unicode_escape is listed out of the surrogateescape codecs
by hand, and for the right reason (a truncated \u escape raises);
unicode_escape and utf_7 already fail _lossless_bytes.
- xmlcharrefreplace text leaves out the control characters and
noncharacters whose references html.unescape drops, not only "&" and
the C1 range.
- The charmap encoding tables leave out U+FFFE, which charmap_build
treats as undefined, and the two encode tests share the strategy.
- test_unicode_escape_with_surrogates compared an expression with
itself; it now checks the unicode_escape round trip and the
raw_unicode_escape round trip on text without backslashes.
- StreamReader.read(size) takes a byte count, so the reads are no
longer expected to return at most that many characters (big5hkscs
decodes one sequence to two). test_reader_read_chars covers the
chars argument of the pure Python reader, which the multibyte
readers do not have, and test_reader_matches_decode compares the
reader with the stateless decoder under every error handler.1 parent 087a37e commit ab96b89
1 file changed
Lines changed: 204 additions & 177 deletions
0 commit comments