[New-bugs-announce] [issue26257] Eliminate buffer_tests.py

Martin Panter report at bugs.python.org
Mon Feb 1 05:49:55 EST 2016

New submission from Martin Panter:

This sort of follows on from other cleanup of test_bytes.py in Issue 19587.

Currently buffer_tests defines one base test class, MixinBytesBufferCommonTests, which is used by test_bytes.py to test bytearray (but not bytes!). However there are other tests defined in test_bytes.py, or string_tests.py, which are run, or could be run, for both bytearray and bytes. I haven’t checking too closely, but I think all the methods in buffer_tests could be merged with other methods and collected into string_tests.BaseTest. Then they would get run for bytes, bytearray, str, and UserString.

The following methods are probably redundant with class string_tests.MixinStrUnicodeUserStringTest (only run for str and UserString). It looks like there is no bytes version of these tests:

* test_islower/upper/title/space/alpha/alnum/digit()
* test_title()
* test_splitlines()

test_capitalize() looks redundant with half of the method in string_tests.CommonTest (also only run for str and UserString). Again there doesn’t seem to be a bytes version of it. I think the common part could be moved into BaseTest, and the unicode-specific part left where it is.

The following are probably also redundant with class string_tests.CommonTest:

* test_ljust/rjust/center()
* test_swapcase()
* test_zfill()

For ljust(), rjust() and center(), there are also tests run for bytes and bytearray in test_bytes.BaseBytesTest that could also be merged at the same time. But swapcase() and zfill() don’t seem to be currently tested for bytes.

components: Tests
messages: 259318
nosy: martin.panter
priority: normal
severity: normal
stage: needs patch
status: open
title: Eliminate buffer_tests.py
type: enhancement
versions: Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list