tests: Fix input_signal
variable in test_returned_sample_count
being too short
#385
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
I believe the way the
input_signal
variable (in thetest_returned_sample_count
test) is currently defined on master may contain a typo.I would expect
input_signal
to represent a realistic input that would contain 1s worth of samples for different sample rates.Currently, it always contain 3 samples, which makes the different chunk sizes testing mostly worthless.
Solution
Switching the order of parameters when calling
np.linspace
creates a more realistic input (mostly, a longer array).I kept using np.linspace instead of switching to np.rand (that might be more realistic?) because
np.linspace
is probably faster to run.Result
The test is still green, but it now more accurately covers/tests all different chunk_sizes scenarios.
Additional context
I was working on fixing issue #287 (which I believe I may have a fix for) and I wanted to amend the
returned_sample_count
test to make it cover the problem highlighted in #287. The way np.linspace was called surprised me so I first want to make sure Im understanding this properly :)