Skip to content

Extend curses tests to cover non-ASCII characters under 8-bit locales #152415

Description

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions