Skip to content

Commit be7435e

Browse files
authored
prepare version 1.1.2 and fix tests (#163)
* prepare version 1.1.2 and fix tests * tests: add print on exception
1 parent 436d4ed commit be7435e

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

HISTORY.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
History
33
=======
44

5+
1.1.2
6+
-----
7+
8+
- Fix cyclic import by @juanjoDiaz (#148)
9+
- Fix language detector proportion_in_each_language results by @juanjoDiaz (#150)
10+
- Init: use explicit re-exports (#151)
11+
- Fix data written by dictionary pickler by @Dunedan (#156)
12+
- Add demo rules for Latvian and Estonian (#154, #157)
13+
- Remove deprecated langdetect submodule (#160)
14+
- Test: remove dummy pickled data (#161)
15+
- Language data: upgrade pickle to v5 (#162)
16+
517

618
1.1.1
719
-----

simplemma/__metadata__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
__author__ = "Adrien Barbaresi, Juanjo Diaz and contributors"
1616
__email__ = "[email protected]"
1717
__license__ = "MIT"
18-
__version__ = "1.1.1"
18+
__version__ = "1.1.2"

tests/test_dictionary_pickler.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
import os
21
import tempfile
32

3+
from os import path, remove
4+
45
from training import dictionary_pickler
56

6-
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
7+
TEST_DIR = path.abspath(path.dirname(__file__))
78

89

910
def test_logic() -> None:
1011
"""Test if certain code parts correspond to the intended logic."""
1112
# dict generation
12-
testfile = os.path.join(TEST_DIR, "data/zz.txt")
13+
testfile = path.join(TEST_DIR, "data/zz.txt")
1314
# simple generation, silent mode
1415
mydict = dictionary_pickler._read_dict(testfile, "zz", silent=True)
1516
assert len(mydict) == 3
1617
mydict = dictionary_pickler._load_dict(
17-
"zz", listpath=os.path.join(TEST_DIR, "data"), silent=True
18+
"zz", listpath=path.join(TEST_DIR, "data"), silent=True
1819
)
1920
assert len(mydict) == 3
2021
# log warning
@@ -35,11 +36,14 @@ def test_logic() -> None:
3536
assert dictionary_pickler._determine_path("lists", "de").endswith("de.txt")
3637

3738
# dict pickling
38-
listpath = os.path.join(TEST_DIR, "data")
39+
listpath = path.join(TEST_DIR, "data")
3940
os_handle, temp_outputfile = tempfile.mkstemp(suffix=".pkl", text=True)
4041
dictionary_pickler._pickle_dict("zz", listpath, temp_outputfile)
4142
dictionary_pickler._pickle_dict("zz", listpath, in_place=True)
4243

4344
# remove pickle file
4445
filepath = dictionary_pickler._determine_pickle_path("zz")
45-
os.remove(filepath)
46+
try:
47+
remove(filepath)
48+
except (AttributeError, FileNotFoundError):
49+
print("Pickle file already deleted")

tests/test_language_detector.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Tests for Simplemma's language detection utilities."""
22

3-
import pytest
4-
53
from simplemma import LanguageDetector, in_target_language, langdetect
64
from simplemma.strategies import DefaultStrategy
75

0 commit comments

Comments
 (0)