Skip to content
Snippets Groups Projects
Commit f48150d6 authored by j.detchart's avatar j.detchart
Browse files

update tests

parent 37076f35
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ from tests.constants import ALPHABET, LANGUAGE_FILES
def test_detect_language():
from src.enhanced_occurrence_frequencies import (
from src.occurrence_frequencies import (
compute_occurrence_frequencies, read_text, detect_language
)
......
......@@ -10,7 +10,7 @@ ENTROPIES = {
def test():
from src.data_compression import entropy
from src.enhanced_occurrence_frequencies import (
from src.occurrence_frequencies import (
read_text, compute_occurrence_frequencies
)
......
from tests.constants import ALPHABET
def test_type():
from src.enhanced_occurrence_frequencies import compute_occurrence_frequencies
actual = compute_occurrence_frequencies("a", ALPHABET)
assert isinstance(actual, dict), (
"result of `compute_occurrence_frequencies` should be a dictionary, "
f"found {type(actual).__name__}"
)
assert sorted(actual.keys()) == sorted(list(ALPHABET))
def test_output():
from src.enhanced_occurrence_frequencies import compute_occurrence_frequencies
def test_compute_occurrence_frequencies():
from src.occurrence_frequencies import compute_occurrence_frequencies
actual = compute_occurrence_frequencies(
"this is some random text", ALPHABET
)
......@@ -46,3 +33,13 @@ def test_output():
'y': 0.0,
'z': 0.0,
}
def test_type():
from src.occurrence_frequencies import compute_occurrence_frequencies
actual = compute_occurrence_frequencies("a", ALPHABET)
assert isinstance(actual, dict), (
"result of `compute_occurrence_frequencies` should be a dictionary, "
f"found {type(actual).__name__}"
)
assert sorted(actual.keys()) == sorted(list(ALPHABET))
......@@ -2,7 +2,7 @@ from tests.constants import ALPHABET, LANGUAGE_FILES, PRECISION
def test_kl_div():
from src.enhanced_occurrence_frequencies import (
from src.occurrence_frequencies import (
read_text, compute_occurrence_frequencies, kl_divergence
)
......
def test_read_text():
from src.enhanced_occurrence_frequencies import read_text
from src.occurrence_frequencies import read_text
for (file, expected, msg) in [
("tests/sample.txt", "this is a sample text file\n", None),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment