Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Jun 22, 2015
1 parent 3d52fe8 commit a50950d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -5,6 +5,7 @@ omit =

[report]
exclude_lines =
pragma: no cover
except NameError
except ImportError
pass
Expand Down
12 changes: 11 additions & 1 deletion tests/test_others.py
Expand Up @@ -3,11 +3,21 @@
from __future__ import unicode_literals

from pypinyin import * # noqa
from .utils import has_module
from pypinyin import simple_seg


def test_import_all():
pinyin('啦啦啦')
pinyin('啦啦啦', TONE2)
lazy_pinyin('啦啦啦')
slug('啦啦啦')


def test_simple_seg():
assert simple_seg('啦啦') == ['啦啦']
assert simple_seg('啦啦abc') == ['啦啦', 'abc']
assert simple_seg('&##啦啦abc') == ['&##', '啦啦', 'abc']
assert simple_seg('&#哦#啦啦abc') == ['&#', '哦', '#', '啦啦', 'abc']
assert simple_seg('哦ほ#') == ['哦', 'ほ#']
assert simple_seg(['啦啦']) == ['啦啦']
assert simple_seg(['啦啦', 'abc']) == ['啦啦', 'abc']
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -44,4 +44,4 @@ deps =
setenv =
PYPINYIN_NO_PHRASES = true
PYPINYIN_NO_JIEBA = true
commands = py.test tests/_test_env.py
commands = py.test --cov pypinyin/__init__.py tests/_test_env.py

0 comments on commit a50950d

Please sign in to comment.