Repository navigation
gh-94808: add tests covering PySequence_[InPlace_]Repeat - #99196
Conversation
|
Merge conflicts are resolved, @serhiy-storchaka would you mind taking a look? :) |
skirpichev
left a comment
There was a problem hiding this comment.
Looks good, except for few pep7 nitpicks.
On another hand, I'm not sure if this is a right approach to test abstract interfaces. Another example is PyNumber_* API (#111996). Maybe we should use special, dedicated just for tests types, that have required magic methods, instead of using core types?
| sequence_inplace_repeat(PyObject* self, PyObject *args) | ||
| { | ||
| PyObject *sequence; | ||
| Py_ssize_t count; |
There was a problem hiding this comment.
PEP 7: blank line after local variable declarations;)
| sequence_repeat(PyObject* self, PyObject *args) | ||
| { | ||
| PyObject *sequence; | ||
| Py_ssize_t count; |
|
This PR is stale because it has been open for 30 days with no activity. |
|
Reopening. This was prematurely closed because the meta issue was misidentified as a simple issue. |
Co-authored-by: Muse Code (Meta Muse Spark) # Conflicts: # Lib/test/test_capi/test_misc.py # Modules/_testcapimodule.c
Drop the basic repeat/in-place-repeat tests: test_abstract.py now covers those paths via _testlimitedcapi (including corner counts, MemoryError, TypeError and NULL cases). Keep the subtype and error tests unique to this PR. Add test_sequence_repeat_numeric_fallback for the previously untested nb_multiply fallback in PySequence_Repeat. Assert exact result types with assertIs: comparing against CustomList(...) only checks contents, and repeat of a builtin subtype returns the exact builtin type. Co-authored-by: Muse Code (Meta Muse Spark)
Things I've skipped:
NULLchecks forPyLongallocation andNULLcheck forself. Cannot be reproduced from pythonsq_repeatandsq_inplace_repeat, I expect them to be covered in*and*=operatorsCoverage view before:
