|
4 | 4 | from bisearch.prefix import NotFound |
5 | 5 |
|
6 | 6 |
|
7 | | -def test_prefix_right(strings_large, prefix_right_fixture): |
| 7 | +def test_prefix_right(strings_large_fixture, prefix_right_fixture): |
8 | 8 | search, test_value = prefix_right_fixture |
9 | | - assert prefix.bisect_right(strings_large, search) == test_value |
| 9 | + assert prefix.bisect_right(strings_large_fixture, search) == test_value |
10 | 10 |
|
11 | 11 |
|
12 | | -def test_prefix_left(strings_large, prefix_left_fixture): |
| 12 | +def test_prefix_left(strings_large_fixture, prefix_left_fixture): |
13 | 13 | search, test_value = prefix_left_fixture |
14 | | - assert prefix.bisect_left(strings_large, search) == test_value |
| 14 | + assert prefix.bisect_left(strings_large_fixture, search) == test_value |
15 | 15 |
|
16 | 16 |
|
17 | | -def test_find_all(strings_large, find_all_fixture): |
| 17 | +def test_find_all(strings_large_fixture, find_all_fixture): |
18 | 18 | search, test_value = find_all_fixture |
19 | | - assert prefix.find_all(strings_large, search) == test_value |
| 19 | + assert prefix.find_all(strings_large_fixture, search) == test_value |
20 | 20 |
|
21 | 21 |
|
22 | | -def test_prefix_right_default(strings_small): |
23 | | - assert prefix.bisect_right(strings_small) == len(strings_small) |
| 22 | +def test_prefix_right_default(strings_small_fixture): |
| 23 | + string_idx = len(strings_small_fixture) |
| 24 | + assert prefix.bisect_right(strings_small_fixture) == string_idx |
24 | 25 |
|
25 | 26 |
|
26 | | -def test_prefix_left_default(strings_small): |
27 | | - assert prefix.bisect_left(strings_small) == 0 |
| 27 | +def test_prefix_left_default(strings_small_fixture): |
| 28 | + assert prefix.bisect_left(strings_small_fixture) == 0 |
28 | 29 |
|
29 | 30 |
|
30 | | -def test_find_all_default(strings_small): |
31 | | - assert prefix.find_all(strings_small) == strings_small |
| 31 | +def test_find_all_default(strings_small_fixture): |
| 32 | + assert prefix.find_all(strings_small_fixture) == strings_small_fixture |
32 | 33 |
|
33 | 34 |
|
34 | | -def test_prefix_right_negative(strings_small): |
| 35 | +def test_prefix_right_last(strings_small_fixture): |
| 36 | + string_idx = len(strings_small_fixture) |
| 37 | + assert prefix.bisect_right(strings_small_fixture, "cab") == string_idx |
| 38 | + |
| 39 | + |
| 40 | +def test_prefix_left_last(strings_small_fixture): |
| 41 | + string_idx = len(strings_small_fixture) - 1 |
| 42 | + assert prefix.bisect_left(strings_small_fixture, "cab") == string_idx |
| 43 | + |
| 44 | + |
| 45 | +def test_prefix_right_negative(strings_small_fixture): |
35 | 46 | with pytest.raises(NotFound): |
36 | | - prefix.bisect_right(strings_small, "d") |
| 47 | + prefix.bisect_right(strings_small_fixture, "d") |
37 | 48 |
|
38 | 49 |
|
39 | | -def test_prefix_left_negative(strings_small): |
| 50 | +def test_prefix_left_negative(strings_small_fixture): |
40 | 51 | with pytest.raises(NotFound): |
41 | | - prefix.bisect_left(strings_small, "d") |
| 52 | + prefix.bisect_left(strings_small_fixture, "d") |
42 | 53 |
|
43 | 54 |
|
44 | | -def test_find_all_negative(strings_small): |
45 | | - assert prefix.find_all(strings_small, "d") == [] |
| 55 | +def test_find_all_negative(strings_small_fixture): |
| 56 | + assert prefix.find_all(strings_small_fixture, "d") == [] |
0 commit comments