Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare version 1.1.2 and fix tests #163

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
History
=======

1.1.2
-----

- Fix cyclic import by @juanjoDiaz (#148)
- Fix language detector proportion_in_each_language results by @juanjoDiaz (#150)
- Init: use explicit re-exports (#151)
- Fix data written by dictionary pickler by @Dunedan (#156)
- Add demo rules for Latvian and Estonian (#154, #157)
- Remove deprecated langdetect submodule (#160)
- Test: remove dummy pickled data (#161)
- Language data: upgrade pickle to v5 (#162)


1.1.1
-----
Expand Down
2 changes: 1 addition & 1 deletion simplemma/__metadata__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
__author__ = "Adrien Barbaresi, Juanjo Diaz and contributors"
__email__ = "[email protected]"
__license__ = "MIT"
__version__ = "1.1.1"
__version__ = "1.1.2"
16 changes: 10 additions & 6 deletions tests/test_dictionary_pickler.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import os
import tempfile

from os import path, remove

from training import dictionary_pickler

TEST_DIR = os.path.abspath(os.path.dirname(__file__))
TEST_DIR = path.abspath(path.dirname(__file__))


def test_logic() -> None:
"""Test if certain code parts correspond to the intended logic."""
# dict generation
testfile = os.path.join(TEST_DIR, "data/zz.txt")
testfile = path.join(TEST_DIR, "data/zz.txt")
# simple generation, silent mode
mydict = dictionary_pickler._read_dict(testfile, "zz", silent=True)
assert len(mydict) == 3
mydict = dictionary_pickler._load_dict(
"zz", listpath=os.path.join(TEST_DIR, "data"), silent=True
"zz", listpath=path.join(TEST_DIR, "data"), silent=True
)
assert len(mydict) == 3
# log warning
Expand All @@ -35,11 +36,14 @@ def test_logic() -> None:
assert dictionary_pickler._determine_path("lists", "de").endswith("de.txt")

# dict pickling
listpath = os.path.join(TEST_DIR, "data")
listpath = path.join(TEST_DIR, "data")
os_handle, temp_outputfile = tempfile.mkstemp(suffix=".pkl", text=True)
dictionary_pickler._pickle_dict("zz", listpath, temp_outputfile)
dictionary_pickler._pickle_dict("zz", listpath, in_place=True)

# remove pickle file
filepath = dictionary_pickler._determine_pickle_path("zz")
os.remove(filepath)
try:
remove(filepath)
except (AttributeError, FileNotFoundError):
print("Pickle file already deleted")
Fixed Show fixed Hide fixed
2 changes: 0 additions & 2 deletions tests/test_language_detector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Tests for Simplemma's language detection utilities."""

import pytest

from simplemma import LanguageDetector, in_target_language, langdetect
from simplemma.strategies import DefaultStrategy

Expand Down
Loading