Skip to content

Commit

Permalink
Try to fix tests for Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
miso-belica committed Mar 7, 2020
1 parent 612e071 commit 01ec7cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ before_install:
install:
- pip install -U pip wheel setuptools
- python setup.py install
- pip install -U numpy tinysegmenter jieba konlpy
# use "JPype1==0.7.1" (for kolnpy) because of Python 2 support
- pip install numpy tinysegmenter jieba "JPype1==0.7.1" konlpy
- python -c "import nltk; nltk.download('punkt')"
- pip install -U pytest codecov pytest-cov

Expand Down
6 changes: 5 additions & 1 deletion tests/test_tokenizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import absolute_import, division, print_function, unicode_literals

import sys

import pytest

from sumy.nlp.tokenizers import Tokenizer
Expand Down Expand Up @@ -55,10 +57,11 @@ def test_language_getter():
"好用的文档自动化摘要程序",
("好用", "的", "文档", "自动化", "摘要", "程序"),
),
(
pytest.param(
"korean",
"대학에서 DB, 통계학, 이산수학 등을 배웠지만...",
("대학", "통계학", "이산", "이산수학", "수학", "등"),
marks=pytest.mark.skipif(sys.version_info < (3,), reason="JPype1 from konlpy does not support Python 2 anymore")
),
])
def test_tokenize_sentence_to_words(language, sentence, expected_words):
Expand Down Expand Up @@ -137,6 +140,7 @@ def test_tokenize_chinese_paragraph():
assert expected == tokenizer.to_sentences(paragraph)


@pytest.mark.skipif(sys.version_info < (3,), reason="JPype1 from konlpy does not support Python 2 anymore")
def test_tokenize_korean_paragraph():
tokenizer = Tokenizer('korean')
expected = (
Expand Down

0 comments on commit 01ec7cd

Please sign in to comment.