Compare commits
No commits in common. "c8s" and "c8" have entirely different histories.
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,7 +1 @@
|
|||||||
artifacts/
|
SOURCES/pyenchant-2.0.0.tar.gz
|
||||||
pyenchant-1.3.1.tar.gz
|
|
||||||
/pyenchant-1.6.5.tar.gz
|
|
||||||
/pyenchant-1.6.6.tar.gz
|
|
||||||
/pyenchant-1.6.8.tar.gz
|
|
||||||
/pyenchant-1.6.10.tar.gz
|
|
||||||
/pyenchant-2.0.0.tar.gz
|
|
||||||
|
1
.python-enchant.metadata
Normal file
1
.python-enchant.metadata
Normal file
@ -0,0 +1 @@
|
|||||||
|
92ca797bbef9660271c3a9269ff7eb841272044d SOURCES/pyenchant-2.0.0.tar.gz
|
@ -1,6 +0,0 @@
|
|||||||
--- !Policy
|
|
||||||
product_versions:
|
|
||||||
- rhel-8
|
|
||||||
decision_context: osci_compose_gate
|
|
||||||
rules:
|
|
||||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
|
1
sources
1
sources
@ -1 +0,0 @@
|
|||||||
SHA512 (pyenchant-2.0.0.tar.gz) = c985714bc8ad69b6580fa1dd546243da5f3f92e8681d846ed265b086c486ae7ed33754fba303b450be4c0cb20e975a9a10efbeb700ea5213a11ed00612a93af0
|
|
@ -1,3 +0,0 @@
|
|||||||
cantle
|
|
||||||
estivation
|
|
||||||
activation
|
|
@ -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