Files
RustPython/extra_tests
Yubin KimandJeong, YunWon c420cc564c Rebase range iterator __reduce__ to match CPython (#8424)
* Rebase range iterator __reduce__ to match CPython

range_iterator.__reduce__ (and longrange_iterator) returned the original
range plus the current index as pickle state; CPython returns the range
rebased to the current position with a None state. Rebase start by
index * step (clamped to the length) and emit None. __setstate__ is kept
so pickles carrying an integer state still load.

Assisted-by: Claude Code:claude-opus-4-8

* Add snippet test for range iterator __reduce__

Assert the rebased range and None state added in the previous commit. The
snippet runner executes it under both CPython and RustPython, so it also
cross-checks the representation against CPython.

Assisted-by: Claude Code:claude-opus-4-8

* Update extra_tests/snippets/builtin_range.py

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-08-21 17:16:40 +09:00
..
2022-07-17 03:25:34 +09:00
2025-12-12 22:46:39 +09:00

Test snippets

This directory contains two sets of test snippets which can be run in Python. The snippets/ directory contains functional tests, and the benchmarks/ directory contains snippets for use in benchmarking RustPython's performance.

Setup

Our testing depends on pytest, which you can install using pip.

Running

Simply run pytest -v in this directory, and the tests should run (and hopefully pass). If it hangs for a long time, that's because it's building RustPython in release mode, which should take less time than it would to run every test snippet with RustPython compiled in debug mode.