forked from pool/python-Pyphen
Accepting request 678059 from home:frispete:python
- Update to version 0.9.5 + Update Bulgarian and Spanish dictionaries, add Indonesian - Add test.py from GH, missing in tarball, enable checks OBS-URL: https://build.opensuse.org/request/show/678059 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Pyphen?expand=0&rev=7
This commit is contained in:
committed by
Git OBS Bridge
parent
6b56d2b465
commit
f7ce74f86a
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:abfa9a0ab055341f6e250c1a6bef395c3a06f0e4cba216eeef37f617b32c0bd7
|
||||
size 1092404
|
||||
3
Pyphen-0.9.5.tar.gz
Normal file
3
Pyphen-0.9.5.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3b633a50873156d777e1f1075ba4d8e96a6ad0a3ca42aa3ea9a6259f93f18921
|
||||
size 2971389
|
||||
@@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 21 16:16:53 UTC 2019 - Hans-Peter Jansen <hpj@urpla.net>
|
||||
|
||||
- Update to version 0.9.5
|
||||
+ Update Bulgarian and Spanish dictionaries, add Indonesian
|
||||
|
||||
- Add test.py from GH, missing in tarball, enable checks
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 4 12:52:39 UTC 2018 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-Pyphen
|
||||
#
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -18,13 +18,15 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-Pyphen
|
||||
Version: 0.9.4
|
||||
Version: 0.9.5
|
||||
Release: 0
|
||||
Summary: Pure Python module to hyphenate text
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later AND MPL-1.1
|
||||
Group: Development/Languages/Python
|
||||
Url: https://github.com/Kozea/Pyphen
|
||||
Source: https://files.pythonhosted.org/packages/source/P/Pyphen/Pyphen-%{version}.tar.gz
|
||||
Source1: https://github.com/Kozea/Pyphen/blob/master/test.py
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
@@ -40,6 +42,7 @@ This module is a fork of python-hyphenator, written by Wilbert Berendsen.
|
||||
|
||||
%prep
|
||||
%setup -q -n Pyphen-%{version}
|
||||
cp %{S:1} test.py
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@@ -48,8 +51,12 @@ This module is a fork of python-hyphenator, written by Wilbert Berendsen.
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%{python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} \
|
||||
py.test-%{$python_bin_suffix} test.py}
|
||||
|
||||
%files %{python_files}
|
||||
%doc README
|
||||
%doc README
|
||||
%license COPYING COPYING.GPL COPYING.LGPL COPYING.MPL
|
||||
%{python_sitelib}/*
|
||||
|
||||
|
||||
136
test.py
Normal file
136
test.py
Normal file
@@ -0,0 +1,136 @@
|
||||
# This file is part of Pyphen
|
||||
#
|
||||
# Copyright 2013 - Guillaume Ayoub <guillaume.ayoub@kozea.fr>
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation, either version 2.1 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyphen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
|
||||
Pyphen Tests
|
||||
============
|
||||
|
||||
Tests can be launched with:
|
||||
|
||||
- Pytest (``py.test test.py``).
|
||||
- Nose (``nosetests``).
|
||||
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pyphen
|
||||
|
||||
|
||||
def test_inserted():
|
||||
"""Test the ``inserted`` method."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL')
|
||||
assert dic.inserted('lettergrepen') == 'let-ter-gre-pen'
|
||||
|
||||
|
||||
def test_wrap():
|
||||
"""Test the ``wrap`` method."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL')
|
||||
assert dic.wrap('autobandventieldopje', 11) == (
|
||||
'autoband-', 'ventieldopje')
|
||||
|
||||
|
||||
def test_iterate():
|
||||
"""Test the ``iterate`` method."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL')
|
||||
assert tuple(dic.iterate('Amsterdam')) == (
|
||||
('Amster', 'dam'), ('Am', 'sterdam'))
|
||||
|
||||
|
||||
def test_fallback_dict():
|
||||
"""Test the ``iterate`` method with a fallback dict."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL-variant')
|
||||
assert tuple(dic.iterate('Amsterdam')) == (
|
||||
('Amster', 'dam'), ('Am', 'sterdam'))
|
||||
|
||||
|
||||
def test_missing_dict():
|
||||
"""Test a missing dict."""
|
||||
try:
|
||||
pyphen.Pyphen(lang='mi_SS')
|
||||
except KeyError:
|
||||
pass
|
||||
else: # pragma: no cover
|
||||
raise Exception('Importing a missing dict must raise a KeyError')
|
||||
|
||||
|
||||
def test_personal_dict():
|
||||
"""Test a personal dict."""
|
||||
dic = pyphen.Pyphen(lang='fr')
|
||||
assert dic.inserted('autobandventieldopje') != 'au-to-band-ven-tiel-dop-je'
|
||||
pyphen.LANGUAGES['fr'] = pyphen.LANGUAGES['nl_NL']
|
||||
dic = pyphen.Pyphen(lang='fr')
|
||||
assert dic.inserted('autobandventieldopje') == 'au-to-band-ven-tiel-dop-je'
|
||||
|
||||
|
||||
def test_left_right():
|
||||
"""Test the ``left`` and ``right`` parameters."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL')
|
||||
assert dic.inserted('lettergrepen') == 'let-ter-gre-pen'
|
||||
dic = pyphen.Pyphen(lang='nl_NL', left=4)
|
||||
assert dic.inserted('lettergrepen') == 'letter-gre-pen'
|
||||
dic = pyphen.Pyphen(lang='nl_NL', right=4)
|
||||
assert dic.inserted('lettergrepen') == 'let-ter-grepen'
|
||||
dic = pyphen.Pyphen(lang='nl_NL', left=4, right=4)
|
||||
assert dic.inserted('lettergrepen') == 'letter-grepen'
|
||||
|
||||
|
||||
def test_filename():
|
||||
"""Test the ``filename`` parameter."""
|
||||
dic = pyphen.Pyphen(filename=pyphen.LANGUAGES['nl_NL'])
|
||||
assert dic.inserted('lettergrepen') == 'let-ter-gre-pen'
|
||||
|
||||
|
||||
def test_alternative():
|
||||
"""Test the alternative parser."""
|
||||
dic = pyphen.Pyphen(lang='hu', left=1, right=1)
|
||||
assert tuple(dic.iterate('kulissza')) == (
|
||||
('kulisz', 'sza'), ('ku', 'lissza'))
|
||||
assert dic.inserted('kulissza') == 'ku-lisz-sza'
|
||||
|
||||
|
||||
def test_upper():
|
||||
"""Test uppercase."""
|
||||
dic = pyphen.Pyphen(lang='nl_NL')
|
||||
assert dic.inserted('LETTERGREPEN') == 'LET-TER-GRE-PEN'
|
||||
|
||||
|
||||
def test_upper_alternative():
|
||||
"""Test uppercase with alternative parser."""
|
||||
dic = pyphen.Pyphen(lang='hu', left=1, right=1)
|
||||
assert tuple(dic.iterate('KULISSZA')) == (
|
||||
('KULISZ', 'SZA'), ('KU', 'LISSZA'))
|
||||
assert dic.inserted('KULISSZA') == 'KU-LISZ-SZA'
|
||||
|
||||
|
||||
def test_all_dictionaries():
|
||||
"""Test that all included dictionaries can be parsed."""
|
||||
for lang in pyphen.LANGUAGES:
|
||||
pyphen.Pyphen(lang=lang)
|
||||
|
||||
|
||||
def test_fallback():
|
||||
"""Test the language fallback algorithm."""
|
||||
assert pyphen.language_fallback('en') == 'en'
|
||||
assert pyphen.language_fallback('en_US') == 'en_US'
|
||||
assert pyphen.language_fallback('en_FR') == 'en'
|
||||
assert pyphen.language_fallback('en-Latn-US') == 'en_Latn_US'
|
||||
assert pyphen.language_fallback('en-Cyrl-US') == 'en'
|
||||
assert pyphen.language_fallback('fr-Latn-FR') == 'fr'
|
||||
assert pyphen.language_fallback('en-US_variant1-x') == 'en_US'
|
||||
Reference in New Issue
Block a user