The non-ASCII tests in test_curses only exercise whatever the test runner's locale can encode, which in practice is UTF-8. As a result the byte-oriented (8-bit locale) code paths of the curses module are barely tested, and several text-accepting methods are tested only with ASCII.
This proposes extending the existing character and string I/O tests with cases for 8-bit encodings, each guarded by the existing encodability check so a case is skipped when the current locale cannot represent it. The cases cover ASCII, a character common to the Latin encodings (é), and characters distinctive to a single encoding (byte 0xA4 is ¤ in ISO-8859-1, € in ISO-8859-15, є in KOI8-U). Running the whole suite under different locales (e.g. LANG=en_US.ISO8859-1, en_US.ISO8859-15, uk_UA.koi8u) then covers those encodings.
It also fills read-side and other coverage gaps found by an audit of the text-accepting API: inch/instr, get_wstr (previously untested), getbkgd/getbkgrnd, unctrl, the default border()/box() ACS cells, and characters given as chtype ints > 127.
This is test-only; there is no behaviour change.
Linked PRs
The non-ASCII tests in
test_cursesonly exercise whatever the test runner's locale can encode, which in practice is UTF-8. As a result the byte-oriented (8-bit locale) code paths of the curses module are barely tested, and several text-accepting methods are tested only with ASCII.This proposes extending the existing character and string I/O tests with cases for 8-bit encodings, each guarded by the existing encodability check so a case is skipped when the current locale cannot represent it. The cases cover ASCII, a character common to the Latin encodings (
é), and characters distinctive to a single encoding (byte 0xA4 is¤in ISO-8859-1,€in ISO-8859-15,єin KOI8-U). Running the whole suite under different locales (e.g.LANG=en_US.ISO8859-1,en_US.ISO8859-15,uk_UA.koi8u) then covers those encodings.It also fills read-side and other coverage gaps found by an audit of the text-accepting API:
inch/instr,get_wstr(previously untested),getbkgd/getbkgrnd,unctrl, the defaultborder()/box()ACS cells, and characters given aschtypeints > 127.This is test-only; there is no behaviour change.
Linked PRs