Exemplo n.º 1
0
def test_main():
    """Test trigrams main function."""
    import trigrams
    assert len(trigrams.main('text/text_test.txt', 5).split(' ')) == 5
Exemplo n.º 2
0
def test_main():
    """Test main output function."""
    from trigrams import main
    res = main('LICENSE', 5)
    assert res >= 1
Exemplo n.º 3
0
def test_main():
    """Test that our listed function produced the desired output."""
    from trigrams import main
    assert len(main('sherlock.txt', 100).split()) == 100
    assert type(main('sherlock.txt', 100)) == str
Exemplo n.º 4
0
def test_num_words():
    """."""
    from trigrams import main
    text = main('test.txt', 500)
    assert len(text.split()) == 500
Exemplo n.º 5
0
def test_file_length():
    """Test to check trigram file length."""
    from trigrams import main
    assert len(main(TEST_STRING2, TEST_LENGTH).split()) == TEST_LENGTH
Exemplo n.º 6
0
def test_main_text_length_returns_expected():
    """Test that main function returns meets the requested number of words."""
    from trigrams import main
    assert len((main('sherlock_small.txt', 50).split(" "))) >= 50
Exemplo n.º 7
0
def test_open_text_file():
    """Test that main function can open a file."""
    from trigrams import main
    main('test_book.txt', 1)
Exemplo n.º 8
0
def test_zero_words_from_main():
    """Test that main funciton returns empty string for 0 words."""
    from trigrams import main
    assert main('test_book.txt', 0) == ''
Exemplo n.º 9
0
def test_invalid_text_file():
    """Test that main function raises exception on non-existant file."""
    from trigrams import main
    with pytest.raises(FileNotFoundError):
        main('test_text.txt', 1)