-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from sfendourakis/master
minor refactoring and signature test
- Loading branch information
Showing
3 changed files
with
29 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from shazamio.algorithm import SignatureGenerator | ||
from shazamio.signature import DecodedMessage | ||
import random | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def signature_instance(): | ||
instance = SignatureGenerator() | ||
instance.input_pending_processing = [ | ||
random.randint(-32768, 32767) for _ in range(128 * 2) | ||
] | ||
return instance | ||
|
||
|
||
def test_no_samples_to_process(signature_instance): | ||
signature_instance.samples_processed = len( | ||
signature_instance.input_pending_processing | ||
) | ||
result = signature_instance.get_next_signature() | ||
assert result is None | ||
|
||
|
||
def test_successful_signature_extraction(signature_instance): | ||
result = signature_instance.get_next_signature() | ||
assert isinstance(result, DecodedMessage) |