Coverage for test_wordlist.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-07 06:52 +0200

1import tempfile 

2from edictor.wordlist import fetch_wordlist, get_wordlist 

3from pathlib import Path 

4import os 

5import codecs 

6 

7 

8def test_fetch_wordlist(): 

9 

10 data = fetch_wordlist("ltkkaren") 

11 assert data[:2] == "ID" 

12 

13 

14def test_get_wordlist(): 

15 

16 def prep(wordlist): 

17 return wordlist 

18 

19 test_path = Path(__file__).parent.joinpath('data') 

20 fn = test_path / "cldf" / "cldf-metadata.json" 

21 pp = test_path / "prep.py" 

22 with tempfile.TemporaryDirectory() as t: 

23 os.chdir(t) 

24 get_wordlist(fn, "bai") 

25 get_wordlist(fn, "bai", preprocessing=prep, lexibase=True) 

26