|
1 | 1 | """Unit tests for get_base_indices_for_anchored_blocks.""" |
2 | 2 |
|
3 | | -import pytest |
4 | 3 | import torch |
5 | 4 |
|
6 | 5 | from speculators.models.dflash.utils import get_base_indices_for_anchored_blocks |
@@ -44,31 +43,3 @@ def test_output_dtype_is_long(self): |
44 | 43 | anchor_positions = torch.tensor([[2.0, 5.0]]) |
45 | 44 | result = get_base_indices_for_anchored_blocks(anchor_positions, block_size=2) |
46 | 45 | assert result.dtype == torch.long |
47 | | - |
48 | | - def test_total_seq_len_valid(self): |
49 | | - anchor_positions = torch.tensor([[0, 3]]) |
50 | | - result = get_base_indices_for_anchored_blocks( |
51 | | - anchor_positions, block_size=4, total_seq_len=7 |
52 | | - ) |
53 | | - expected = torch.tensor([0, 1, 2, 3, 3, 4, 5, 6]) |
54 | | - assert torch.equal(result, expected) |
55 | | - |
56 | | - def test_total_seq_len_out_of_range(self): |
57 | | - anchor_positions = torch.tensor([[0, 3]]) |
58 | | - with pytest.raises(ValueError, match="out of range"): |
59 | | - get_base_indices_for_anchored_blocks( |
60 | | - anchor_positions, block_size=4, total_seq_len=6 |
61 | | - ) |
62 | | - |
63 | | - def test_negative_anchor_raises(self): |
64 | | - anchor_positions = torch.tensor([[-1, 3]]) |
65 | | - with pytest.raises(ValueError, match="out of range"): |
66 | | - get_base_indices_for_anchored_blocks(anchor_positions, block_size=2) |
67 | | - |
68 | | - def test_no_total_seq_len_skips_upper_bound_check(self): |
69 | | - anchor_positions = torch.tensor([[100]]) |
70 | | - result = get_base_indices_for_anchored_blocks( |
71 | | - anchor_positions, block_size=3, total_seq_len=None |
72 | | - ) |
73 | | - expected = torch.tensor([100, 101, 102]) |
74 | | - assert torch.equal(result, expected) |
0 commit comments