Compare commits
No commits in common. "c8s" and "c10s" have entirely different histories.
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,7 +1,11 @@
|
|||||||
artifacts/
|
|
||||||
pyenchant-1.3.1.tar.gz
|
pyenchant-1.3.1.tar.gz
|
||||||
/pyenchant-1.6.5.tar.gz
|
/pyenchant-1.6.5.tar.gz
|
||||||
/pyenchant-1.6.6.tar.gz
|
/pyenchant-1.6.6.tar.gz
|
||||||
/pyenchant-1.6.8.tar.gz
|
/pyenchant-1.6.8.tar.gz
|
||||||
/pyenchant-1.6.10.tar.gz
|
/pyenchant-1.6.10.tar.gz
|
||||||
/pyenchant-2.0.0.tar.gz
|
/pyenchant-2.0.0.tar.gz
|
||||||
|
/pyenchant-3.0.1.tar.gz
|
||||||
|
/pyenchant-3.1.1.tar.gz
|
||||||
|
/pyenchant-3.2.0.tar.gz
|
||||||
|
/pyenchant-3.2.1.tar.gz
|
||||||
|
/pyenchant-3.2.2.tar.gz
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- !Policy
|
--- !Policy
|
||||||
product_versions:
|
product_versions:
|
||||||
- rhel-8
|
- rhel-10
|
||||||
decision_context: osci_compose_gate
|
decision_context: osci_compose_gate
|
||||||
rules:
|
rules:
|
||||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/internal/CI-Tier-1.functional}
|
||||||
|
5
plans/basic.fmf
Normal file
5
plans/basic.fmf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
summary: Basic smoke test
|
||||||
|
discover:
|
||||||
|
how: fmf
|
||||||
|
execute:
|
||||||
|
how: tmt
|
11
plans/internal/CI-Tier-1.fmf
Normal file
11
plans/internal/CI-Tier-1.fmf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
summary: Internal CI-Tier-1 tests plan
|
||||||
|
discover:
|
||||||
|
- name: python-enchant
|
||||||
|
how: fmf
|
||||||
|
filter: 'tag: CI-Tier-1'
|
||||||
|
url: https://pkgs.devel.redhat.com/git/tests/python-enchant
|
||||||
|
execute:
|
||||||
|
how: tmt
|
||||||
|
adjust:
|
||||||
|
enabled: false
|
||||||
|
when: distro == centos-stream or distro == fedora
|
@ -1,60 +1,29 @@
|
|||||||
# Work around a problem with libenchant versioning
|
|
||||||
# (python-enchant-1.3.1 failed to work with enchant-1.4.2-2.fc10)
|
|
||||||
%global enchant_dep enchant >= 1.5.0
|
|
||||||
%global srcname enchant
|
%global srcname enchant
|
||||||
|
|
||||||
%if 0%{?rhel} > 7
|
|
||||||
# Disable python2 build by default
|
|
||||||
%bcond_with python2
|
|
||||||
%else
|
|
||||||
%bcond_without python2
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: python-enchant
|
Name: python-enchant
|
||||||
Version: 2.0.0
|
Version: 3.2.2
|
||||||
Release: 3%{?dist}
|
Release: 14%{?dist}
|
||||||
Summary: Python bindings for Enchant spellchecking library
|
Summary: Python bindings for Enchant spellchecking library
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPL-2.1-or-later
|
||||||
URL: http://packages.python.org/pyenchant/
|
URL: https://pyenchant.github.io/pyenchant/
|
||||||
Source0: https://files.pythonhosted.org/packages/source/p/py%{srcname}/py%{srcname}-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/p/py%{srcname}/py%{srcname}-%{version}.tar.gz
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: enchant-devel
|
BuildRequires: enchant2
|
||||||
|
|
||||||
%description
|
%description
|
||||||
PyEnchant is a spellchecking library for Python, based on the Enchant
|
PyEnchant is a spellchecking library for Python, based on the Enchant
|
||||||
library by Dom Lachowicz.
|
library by Dom Lachowicz.
|
||||||
|
|
||||||
%if %{with python2}
|
|
||||||
%package -n python2-%{srcname}
|
|
||||||
Summary: Python 2 bindings for Enchant spellchecking library
|
|
||||||
|
|
||||||
BuildRequires: python2-devel
|
|
||||||
BuildRequires: python2-setuptools
|
|
||||||
# For running tests
|
|
||||||
BuildRequires: python2-nose
|
|
||||||
|
|
||||||
Requires: %{enchant_dep}
|
|
||||||
|
|
||||||
Provides: PyEnchant
|
|
||||||
|
|
||||||
%{?python_provide:%python_provide python2-%{srcname}}
|
|
||||||
|
|
||||||
%description -n python2-%{srcname}
|
|
||||||
PyEnchant is a spellchecking library for Python 2, based on the Enchant
|
|
||||||
library by Dom Lachowicz.
|
|
||||||
%endif # with python2
|
|
||||||
|
|
||||||
%package -n python3-%{srcname}
|
%package -n python3-%{srcname}
|
||||||
Summary: Python 3 bindings for Enchant spellchecking library
|
Summary: Python 3 bindings for Enchant spellchecking library
|
||||||
|
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
# For running tests
|
|
||||||
BuildRequires: python3-nose
|
|
||||||
|
|
||||||
Requires: %{enchant_dep}
|
Requires: enchant2
|
||||||
|
|
||||||
%{?python_provide:%python_provide python3-%{srcname}}
|
%{?python_provide:%python_provide python3-%{srcname}}
|
||||||
|
|
||||||
@ -67,64 +36,26 @@ library by Dom Lachowicz.
|
|||||||
# Remove bundled egg-info
|
# Remove bundled egg-info
|
||||||
rm -rf py%{srcname}.egg-info
|
rm -rf py%{srcname}.egg-info
|
||||||
|
|
||||||
rm -rf %{py3dir}
|
find . -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
|
||||||
cp -a . %{py3dir}
|
|
||||||
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if %{with python2}
|
%py3_build
|
||||||
CFLAGS="$RPM_OPT_FLAGS" %py2_build
|
|
||||||
%endif # with python2
|
|
||||||
|
|
||||||
pushd %{py3dir}
|
|
||||||
CFLAGS="$RPM_OPT_FLAGS" %py3_build
|
|
||||||
popd
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
pushd %{py3dir}
|
%py3_install
|
||||||
%py3_install \
|
|
||||||
--single-version-externally-managed
|
|
||||||
# Directories used in windows build
|
# Directories used in windows build
|
||||||
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/%{srcname}/lib
|
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/%{srcname}/lib
|
||||||
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/%{srcname}/share
|
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/%{srcname}/share
|
||||||
popd
|
|
||||||
%if %{with python2}
|
|
||||||
%py2_install \
|
|
||||||
--single-version-externally-managed
|
|
||||||
# Directories used in windows build
|
|
||||||
rm -rf $RPM_BUILD_ROOT/%{python2_sitelib}/%{srcname}/lib
|
|
||||||
rm -rf $RPM_BUILD_ROOT/%{python2_sitelib}/%{srcname}/share
|
|
||||||
%endif # with python2
|
|
||||||
|
|
||||||
|
|
||||||
|
# Tests are not included in the upstream tarball
|
||||||
%check
|
%check
|
||||||
%if %{with python2}
|
%py3_check_import %{srcname} %{srcname}.checker %{srcname}.tokenize
|
||||||
pushd $RPM_BUILD_ROOT/%{python2_sitelib}
|
|
||||||
# There is no dictionary for language C, need to use en_US
|
|
||||||
LANG=en_US.UTF-8 /usr/bin/nosetests-2.*
|
|
||||||
popd
|
|
||||||
%endif # with python2
|
|
||||||
|
|
||||||
pushd $RPM_BUILD_ROOT/%{python3_sitelib}
|
|
||||||
# There is no dictionary for language C, need to use en_US
|
|
||||||
LANG=en_US.UTF-8 /usr/bin/nosetests-3.*
|
|
||||||
popd
|
|
||||||
|
|
||||||
%if %{with python2}
|
|
||||||
%files -n python2-%{srcname}
|
|
||||||
%doc README.txt TODO.txt
|
|
||||||
%license LICENSE.txt
|
|
||||||
%dir %{python2_sitelib}/%{srcname}
|
|
||||||
%dir %{python2_sitelib}/%{srcname}/checker
|
|
||||||
%dir %{python2_sitelib}/%{srcname}/tokenize
|
|
||||||
%{python2_sitelib}/%{srcname}/*.py
|
|
||||||
%{python2_sitelib}/%{srcname}/*.py[co]
|
|
||||||
%{python2_sitelib}/%{srcname}/*/*.py
|
|
||||||
%{python2_sitelib}/%{srcname}/*/*.py[co]
|
|
||||||
%{python2_sitelib}/py%{srcname}-%{version}-py?.?.egg-info
|
|
||||||
%endif # with python2
|
|
||||||
|
|
||||||
%files -n python3-%{srcname}
|
%files -n python3-%{srcname}
|
||||||
%doc README.txt TODO.txt
|
%doc README.rst
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%dir %{python3_sitelib}/%{srcname}
|
%dir %{python3_sitelib}/%{srcname}
|
||||||
%dir %{python3_sitelib}/%{srcname}/__pycache__
|
%dir %{python3_sitelib}/%{srcname}/__pycache__
|
||||||
@ -138,10 +69,111 @@ popd
|
|||||||
%{python3_sitelib}/%{srcname}/checker/__pycache__/*.py[co]
|
%{python3_sitelib}/%{srcname}/checker/__pycache__/*.py[co]
|
||||||
%{python3_sitelib}/%{srcname}/tokenize/*.py
|
%{python3_sitelib}/%{srcname}/tokenize/*.py
|
||||||
%{python3_sitelib}/%{srcname}/tokenize/__pycache__/*.py[co]
|
%{python3_sitelib}/%{srcname}/tokenize/__pycache__/*.py[co]
|
||||||
%{python3_sitelib}/py%{srcname}-%{version}-py?.?.egg-info
|
%{python3_sitelib}/py%{srcname}-%{version}-py%{python3_version}.egg-info
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 3.2.2-14
|
||||||
|
- Bump release for October 2024 mass rebuild:
|
||||||
|
Resolves: RHEL-64018
|
||||||
|
|
||||||
|
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.2.2-13
|
||||||
|
- Bump release for June 2024 mass rebuild
|
||||||
|
|
||||||
|
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-12
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-11
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Aug 21 2023 Parag Nemade <pnemade AT fedoraproject DOT org> - 3.2.2-10
|
||||||
|
- Migrate to SPDX license expression
|
||||||
|
|
||||||
|
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-9
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jun 15 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.2-8
|
||||||
|
- Update BuildRequires to enchant2
|
||||||
|
- Check imports as a minimal test
|
||||||
|
|
||||||
|
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 3.2.2-7
|
||||||
|
- Rebuilt for Python 3.12
|
||||||
|
|
||||||
|
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-6
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Aug 28 2022 Jens Petersen <petersen@redhat.com> - 3.2.2-5
|
||||||
|
- switch to using enchant2 (#2121993)
|
||||||
|
|
||||||
|
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 3.2.2-3
|
||||||
|
- Rebuilt for Python 3.11
|
||||||
|
|
||||||
|
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.2-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Oct 05 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.2.2-1
|
||||||
|
- Update to 3.2.2 (rhbz#2010984)
|
||||||
|
|
||||||
|
* Tue Aug 03 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.2.1-1
|
||||||
|
- Update to 3.2.1 (rhbz#1975861)
|
||||||
|
|
||||||
|
* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-5
|
||||||
|
- Second attempt - Rebuilt for
|
||||||
|
https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 3.2.0-4
|
||||||
|
- Rebuilt for Python 3.10
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jan 20 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.2.0-2
|
||||||
|
- Drop dependency on python-nose as tests are not included
|
||||||
|
|
||||||
|
* Wed Dec 09 2020 Charalampos Stratakis <cstratak@redhat.com> - 3.2.0-1
|
||||||
|
- Update to 3.2.0 (rhbz#1905482)
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jun 01 2020 Charalampos Stratakis <cstratak@redhat.com> - 3.1.1-1
|
||||||
|
- Update to version 3.1.1 (rhbz#1837989)
|
||||||
|
|
||||||
|
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 3.0.1-2
|
||||||
|
- Rebuilt for Python 3.9
|
||||||
|
|
||||||
|
* Wed Mar 18 2020 Charalampos Stratakis <cstratak@redhat.com> - 3.0.1-1
|
||||||
|
- Update to version 3.0.1 (rhbz#1794914)
|
||||||
|
|
||||||
|
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-11
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Sep 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.0-10
|
||||||
|
- Subpackage python2-enchant has been removed
|
||||||
|
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
|
||||||
|
|
||||||
|
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.0-9
|
||||||
|
- Rebuilt for Python 3.8
|
||||||
|
|
||||||
|
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-8
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-7
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.0-6
|
||||||
|
- Drop explicit locale setting for python3, use C.UTF-8 for python2
|
||||||
|
See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot
|
||||||
|
|
||||||
|
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Jun 17 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.0-4
|
||||||
|
- Rebuilt for Python 3.7
|
||||||
|
|
||||||
* Thu Mar 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.0.0-3
|
* Thu Mar 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.0.0-3
|
||||||
- Conditionalize the python2 subpackage
|
- Conditionalize the python2 subpackage
|
||||||
|
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (pyenchant-2.0.0.tar.gz) = c985714bc8ad69b6580fa1dd546243da5f3f92e8681d846ed265b086c486ae7ed33754fba303b450be4c0cb20e975a9a10efbeb700ea5213a11ed00612a93af0
|
SHA512 (pyenchant-3.2.2.tar.gz) = 65dd6abf51f7dd45d9879c63d9a1d34a4682ef37da961d0eb41849c6bbb707d94d079f5581b5f695a01fd9a9b68e9456d487b4423ed8382882f22eeeb6b080f8
|
||||||
|
7
tests/main.fmf
Normal file
7
tests/main.fmf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require:
|
||||||
|
- python3
|
||||||
|
- python3-enchant
|
||||||
|
- hunspell-en-US
|
||||||
|
- hunspell-de
|
||||||
|
test: python3 test_enchant.py -v
|
||||||
|
framework: shell
|
@ -1,3 +0,0 @@
|
|||||||
cantle
|
|
||||||
estivation
|
|
||||||
activation
|
|
31
tests/test_enchant.py
Normal file
31
tests/test_enchant.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import enchant
|
||||||
|
|
||||||
|
class TestEnchant(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_dummy(self):
|
||||||
|
self.assertEqual(True, True)
|
||||||
|
|
||||||
|
@unittest.expectedFailure
|
||||||
|
def test_expected_failure(self):
|
||||||
|
self.assertEqual(False, True)
|
||||||
|
|
||||||
|
def test_en_US(self):
|
||||||
|
d = enchant.Dict('en_US')
|
||||||
|
self.assertEqual(d.check('enchant'), True)
|
||||||
|
self.assertEqual(d.check('enchnt'), False)
|
||||||
|
self.assertEqual(
|
||||||
|
d.suggest('enchnt'),
|
||||||
|
['enchant', 'entrench', 'tench'])
|
||||||
|
|
||||||
|
def test_de_DE(self):
|
||||||
|
d = enchant.Dict('de_DE')
|
||||||
|
self.assertEqual(d.check('Alpenglühen'), True)
|
||||||
|
self.assertEqual(d.check('Alpengluhen'), False)
|
||||||
|
self.assertEqual(
|
||||||
|
d.suggest('Alpengluhen'),
|
||||||
|
['Alpenglühen', 'Alpengluten', 'Alpenländischen'])
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
@ -1,80 +0,0 @@
|
|||||||
import enchant
|
|
||||||
from enchant.checker import SpellChecker
|
|
||||||
from enchant.tokenize import (get_tokenizer, HTMLChunker, EmailFilter)
|
|
||||||
import unittest
|
|
||||||
import sys
|
|
||||||
|
|
||||||
class TestPyenchant(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_check_dict(self):
|
|
||||||
d = enchant.Dict("en_US")
|
|
||||||
self.assertEqual(d.tag, 'en_US')
|
|
||||||
# invalid test string
|
|
||||||
result = d.check("こんにちは")
|
|
||||||
self.assertFalse(result)
|
|
||||||
# valid test sting
|
|
||||||
result = d.check("Hello")
|
|
||||||
self.assertTrue(result)
|
|
||||||
|
|
||||||
def test_dict_exist(self):
|
|
||||||
# invalid locale
|
|
||||||
result = enchant.dict_exists("de_kk")
|
|
||||||
self.assertFalse(result)
|
|
||||||
# valid locale
|
|
||||||
result = enchant.dict_exists("en_US")
|
|
||||||
self.assertTrue(result)
|
|
||||||
|
|
||||||
|
|
||||||
def test_suggestion(self):
|
|
||||||
d = enchant.Dict("en_US")
|
|
||||||
# valid string sugesstion
|
|
||||||
result = d.suggest("Hello")
|
|
||||||
self.assertGreater(len(result),0)
|
|
||||||
# invalid string sugesstion
|
|
||||||
result = d.suggest("こんにちは")
|
|
||||||
self.assertEqual(len(result), 0)
|
|
||||||
|
|
||||||
|
|
||||||
def test_personal_word_list(self):
|
|
||||||
d = enchant.DictWithPWL("en_US", "mywords.txt")
|
|
||||||
|
|
||||||
result = d.check("estivation")
|
|
||||||
self.assertTrue(result)
|
|
||||||
|
|
||||||
suggestion_list = d.suggest('estivateion')
|
|
||||||
self.assertIn("estivation", suggestion_list)
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_entire_block(self):
|
|
||||||
chkr = SpellChecker("en_US")
|
|
||||||
chkr.set_text("This is erors text.")
|
|
||||||
errorlist = list()
|
|
||||||
for err in chkr:
|
|
||||||
errorlist.append(err.word)
|
|
||||||
self.assertIn("erors", errorlist)
|
|
||||||
|
|
||||||
|
|
||||||
def test_tokenization(self):
|
|
||||||
tknzr = get_tokenizer("en_US")
|
|
||||||
tknzr_list = [word for word in tknzr("Hello world")]
|
|
||||||
self.assertEqual(tknzr_list, [('Hello', 0), ('world', 6)])
|
|
||||||
|
|
||||||
|
|
||||||
def test_chunkers(self):
|
|
||||||
tknzr = get_tokenizer("en_US",chunkers=(HTMLChunker,))
|
|
||||||
tknzr_list = [w for w in tknzr("Hello <span class='important'>World</span>")]
|
|
||||||
self.assertEqual(tknzr_list ,[('Hello', 0), ('World', 30)])
|
|
||||||
|
|
||||||
|
|
||||||
# logger function
|
|
||||||
def main(out = sys.stderr, verbosity = 2):
|
|
||||||
loader = unittest.TestLoader()
|
|
||||||
suite = loader.loadTestsFromModule(sys.modules[__name__])
|
|
||||||
unittest.TextTestRunner(out, verbosity = verbosity).run(suite)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_log_path = sys.argv[1] if len(sys.argv)>1 else "test.log"
|
|
||||||
with open(test_log_path, 'w') as f:
|
|
||||||
main(f)
|
|
||||||
|
|
||||||
# unittest.main()
|
|
@ -1,34 +0,0 @@
|
|||||||
- hosts: localhost
|
|
||||||
vars:
|
|
||||||
config:
|
|
||||||
packagename: enchant
|
|
||||||
testfilename: test_pyenchant.py
|
|
||||||
logfilepath: /tmp/test.log
|
|
||||||
artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}"
|
|
||||||
|
|
||||||
tags:
|
|
||||||
- classic
|
|
||||||
|
|
||||||
remote_user: root
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Install required package
|
|
||||||
dnf:
|
|
||||||
name:
|
|
||||||
- python3
|
|
||||||
- langpacks-en
|
|
||||||
- "python3-{{ config.packagename }}"
|
|
||||||
|
|
||||||
- name: Test Execution
|
|
||||||
block:
|
|
||||||
- name: Execute the tests
|
|
||||||
command: python3 {{ config.testfilename }} "{{ config.logfilepath }}"
|
|
||||||
|
|
||||||
always:
|
|
||||||
- name: Pull out the artifacts
|
|
||||||
fetch:
|
|
||||||
dest: "{{ config.artifacts }}/"
|
|
||||||
src: "{{ item }}"
|
|
||||||
flat: yes
|
|
||||||
with_items:
|
|
||||||
- "{{ config.logfilepath }}"
|
|
Loading…
Reference in New Issue
Block a user