Ejemplo n.º 1
0
def test_check_shared_phoneme_s(text, expected):
    """Test the _check_shared_phoneme_s function with different cases."""

    word = Word(text)
    observed = word._check_shared_phoneme_s()

    assert observed == expected
Ejemplo n.º 2
0
def test_normalize_text(text_original, text_expected):
    """Test the _normalize_text with different cases."""

    word = Word("ejemplo")
    text_observed = word._normalize_text(text_original)

    assert text_observed == text_expected
Ejemplo n.º 3
0
def test_check_silent_u(text, expected):
    """Test the check_silent_u function with different types of cases."""

    word = Word(text)
    observed = word._check_silent_u()

    assert observed == expected
Ejemplo n.º 4
0
def test_create_word_objects(text):
    """Test the _create_word_objects with different cases."""

    word = Word(text)

    assert isinstance(word, Word)
    assert word.text == text
Ejemplo n.º 5
0
def test_calculate_total_difficulty_none_valid():
    """Test the _calculate_total_difficulty when none of the
    characteristics are valid.
    """

    word = Word("ejemplo")
    word._length = None
    word._silent_letters = None
    word._shared_phonemes = None

    with pytest.raises(ValueError):
        word._calculate_total_difficulty()
Ejemplo n.º 6
0
def test_calculate_total_difficulty(
    difficulty_length,
    difficulty_silent,
    difficulty_shared_phonemes,
    total_difficulty_expected,
):
    """Test the _calculate_total_difficulty."""

    word = Word("ejemplo")
    word._length = difficulty_length
    word._silent_letters = difficulty_silent
    word._shared_phonemes = difficulty_shared_phonemes
    total_difficulty_observed = word._calculate_total_difficulty()

    assert total_difficulty_observed == total_difficulty_expected
Ejemplo n.º 7
0
def test_word_contains_invalid_character(text, expected):
    """Test the _word_contains_invalid_character with different cases."""

    word = Word("ejemplo")
    assert word._word_contains_invalid_character(text) == expected
Ejemplo n.º 8
0
def test_word_length_is_invalid(text, expected):
    """Test the _word_length_is_invalid with different cases."""

    word = Word("ejemplo")
    assert word._word_length_is_invalid(text) == expected