Coverage for src / tests / test_splice.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-02-02 10:52 +0100
« prev ^ index » next coverage.py v7.13.2, created at 2026-02-02 10:52 +0100
1from typing import cast
3import remedapy as R
6class TestSplice:
7 def test_data_first(self):
8 # R.splice(items, start, deleteCount, replacement);
9 assert list(R.splice([1, 2, 3, 4, 5, 6, 7, 8], 2, 3, [])) == [1, 2, 6, 7, 8]
10 assert list(R.splice([1, 2, 3, 4, 5, 6, 7, 8], 2, 3, [9, 10])) == [1, 2, 9, 10, 6, 7, 8]
12 def test_data_last(self):
13 # R.splice(start, deleteCount, replacement)(items);
14 assert R.pipe([1, 2, 3, 4, 5, 6, 7, 8], R.splice(2, 3, cast(list[int], [])), list) == [1, 2, 6, 7, 8]
15 assert R.pipe([1, 2, 3, 4, 5, 6, 7, 8], R.splice(2, 3, [9, 10]), list) == [1, 2, 9, 10, 6, 7, 8]
16 assert R.pipe((x for x in [1, 2, 3, 4, 5, 6, 7, 8]), R.splice(2, 3, cast(list[int], [])), list) == [
17 1,
18 2,
19 6,
20 7,
21 8,
22 ]
23 assert R.pipe((x for x in [1, 2, 3, 4, 5, 6, 7, 8]), R.splice(2, 3, [9, 10]), list) == [1, 2, 9, 10, 6, 7, 8]