Esempio n. 1
0
def test_build_branches():
    # this test file has dict keys mapped to both 1-tuples and 2-tuples
    from trigrams import parse_source
    source_path = TEST_PATH + "/twinkle.txt"
    trigram_dict, source_meta = parse_source(source_path)
    assert trigram_dict == TWINKLE_DICT
Esempio n. 2
0
def test_file_header():
    # also tests blank lines
    from trigrams import parse_source
    source_path = TEST_PATH + "/sherlock_header.txt"
    trigram_dict, source_meta = parse_source(source_path)
    assert trigram_dict == SHERLOCK_SMALLER_DICT
Esempio n. 3
0
def test_file_no_header():
    from trigrams import parse_source
    source_path = TEST_PATH + "/sherlock_smaller.txt"
    trigram_dict, source_meta = parse_source(source_path)
    assert trigram_dict == SHERLOCK_SMALLER_DICT
Esempio n. 4
0
def test_open_source():
    from trigrams import parse_source
    source_path = TEST_PATH + "/dundertest.txt"
    trigram_dict, source_meta = parse_source(source_path)
    assert trigram_dict == {"not real": ("data")}
Esempio n. 5
0
def test_parse_source_notfile():
    from trigrams import parse_source
    source_path = "/usr/bin"
    assert parse_source(source_path) == 2
Esempio n. 6
0
def test_parse_source_notpath():
    from trigrams import parse_source
    source_path = "/usr/usr/usr"
    assert parse_source(source_path) == 1