Coverage for src/tests/test_find_index.py: 100%

1 import remedapy as R

2

3

4 def is_even(x: int) -> bool:

5 return x % 2 == 0

6

7

8 class TestFind:

9 def test_data_first(self):

10 # R.find_index(data, predicate);

11 result = R.find_index([1, 3, 4, 6], is_even)

12 assert result == 2

13

14 def test_data_last(self):

15 # R.find_index(predicate)(data);

16 fn = R.find_index(is_even)

17 result = R.pipe(

18 [1, 3, 4, 6],

19 fn,

20 )

21 assert result == 2