-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit number of frames sent to reflection (#64)
* add sample for frames * add test cases * updated function' * black and isort
- Loading branch information
1 parent
63c90a1
commit ad02c67
Showing
5 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from vision_agent.agent.vision_agent import sample_n_evenly_spaced | ||
|
||
|
||
def test_sample_n_evenly_spaced_side_cases(): | ||
# Test for empty input | ||
assert sample_n_evenly_spaced([], 0) == [] | ||
assert sample_n_evenly_spaced([], 1) == [] | ||
|
||
# Test for n = 0 | ||
assert sample_n_evenly_spaced([1, 2, 3, 4], 0) == [] | ||
|
||
# Test for n = 1 | ||
assert sample_n_evenly_spaced([1, 2, 3, 4], -1) == [] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4], 5) == [1, 2, 3, 4] | ||
|
||
|
||
def test_sample_n_evenly_spaced_even_cases(): | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 2) == [1, 6] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 3) == [1, 3, 6] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 4) == [1, 3, 4, 6] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 5) == [1, 2, 3, 5, 6] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 6) == [1, 2, 3, 4, 5, 6] | ||
|
||
|
||
def test_sample_n_evenly_spaced_odd_cases(): | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 2) == [1, 7] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 3) == [1, 4, 7] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 4) == [1, 3, 5, 7] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 5) == [1, 3, 4, 5, 7] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 6) == [1, 2, 3, 5, 6, 7] | ||
assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 7) == [1, 2, 3, 4, 5, 6, 7] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters