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
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
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
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")}
def test_parse_source_notfile(): from trigrams import parse_source source_path = "/usr/bin" assert parse_source(source_path) == 2
def test_parse_source_notpath(): from trigrams import parse_source source_path = "/usr/usr/usr" assert parse_source(source_path) == 1