示例#1
0
def test_dictionary_considers_dictzip_as_valid(fs):
    fs.create_file("/tmp/valid_path/foo.ifo")
    fs.create_file("/tmp/valid_path/foo.idx")
    fs.create_file("/tmp/valid_path/foo.dict.dz")

    d = stargaze.Dictionary("/tmp/valid_path")

    assert len(d.configs) == 1
示例#2
0
def test_dictionary_considers_syn_file_optional(fs):
    fs.create_file("/tmp/valid_path/foo.ifo")
    fs.create_file("/tmp/valid_path/foo.idx")
    fs.create_file("/tmp/valid_path/foo.dict")

    d = stargaze.Dictionary("/tmp/valid_path")

    assert len(d.configs) == 1
示例#3
0
def test_dictionary_lookup():
    d = stargaze.Dictionary("./docs/words")

    r = d.lookup("word1")

    assert r == "word1_defn"
示例#4
0
def test_dictionary_throws_for_directory_without_dict(fs):
    fs.create_file("/tmp/invalid_path/foo.ifo")
    fs.create_file("/tmp/invalid_path/foo.idx")
    with pytest.raises(stargaze.DictionaryError):
        stargaze.Dictionary("/tmp/invalid_path")
示例#5
0
def test_dictionary_throws_for_invalid_path(fs):
    with pytest.raises(ValueError):
        stargaze.Dictionary("/tmp/nonexistent_path")