예제 #1
0
def test_create_tokens_with_profanity():
    """Testing that the create_tokens function will not create
        a token from profanity"""
    list_responses = ['test this code', ' for bad words', 'such as shit']
    check = edurate_gensim.create_tokens(list_responses)
    assert check == [['test', 'code'], ['bad', 'words']]
    assert ("shit" in check) is False
예제 #2
0
def test_create_tokens_with_no_repeating_words():
    """Testing that the create_tokens function will create tokens
        from a list of strings. A given word must have a length
        of at least 3 characters to be considered a token. In this
        test, we have zero repeating words"""
    list_responses = ['I am testing', 'this is a test', 'make my tokens']
    check = edurate_gensim.create_tokens(list_responses)
    assert check == [['testing'], ['test'], ['make', 'tokens']]
    assert ("am" in check) is False
    assert ("my" in check) is False
예제 #3
0
def test_create_tokens_with_repeating_words():
    """Testing the create_tokens function works properly when
        given a list with repeating words."""
    list_responses = [
        'I am testing', 'testing testing testing', 'make my tokens'
    ]
    check = edurate_gensim.create_tokens(list_responses)
    assert check == [['testing'], ['testing', 'testing', 'testing'],
                     ['make', 'tokens']]
    assert ("I" in check) is False
    assert ("am" in check) is False
    assert ("my" in check) is False