-
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import deoplete.util as util | ||
|
||
def test_fuzzy_escapse(): | ||
assert fuzzy_escape('foo', 0) == 'f[^f]*o[^o]*o[^o]*' | ||
assert fuzzy_escape('foo', 1) == 'f[^f]*o[^o]*o[^o]*' | ||
assert fuzzy_escape('Foo', 1) == 'F[^F]*[oO].*[oO].*' | ||
assert util.fuzzy_escape('foo', 0) == 'f[^f]*o[^o]*o[^o]*' | ||
assert util.fuzzy_escape('foo', 1) == 'f[^f]*o[^o]*o[^o]*' | ||
assert util.fuzzy_escape('Foo', 1) == 'F[^F]*[oO].*[oO].*' | ||
|
||
def test_overlap_length(): | ||
assert overlap_length('foo bar', 'bar baz') == 3 | ||
assert overlap_length('foobar', 'barbaz') == 3 | ||
assert overlap_length('foob', 'baz') == 1 | ||
assert overlap_length('foobar', 'foobar') == 6 | ||
assert overlap_length('тест', 'ст') == len('ст') | ||
assert util.overlap_length('foo bar', 'bar baz') == 3 | ||
assert util.overlap_length('foobar', 'barbaz') == 3 | ||
assert util.overlap_length('foob', 'baz') == 1 | ||
assert util.overlap_length('foobar', 'foobar') == 6 | ||
assert util.overlap_length('тест', 'ст') == len('ст') | ||
|
||
def test_charwidth(): | ||
assert charwidth('f') == 1 | ||
assert charwidth('あ') == 2 | ||
assert util.charwidth('f') == 1 | ||
assert util.charwidth('あ') == 2 | ||
|
||
def test_strwidth(): | ||
assert strwidth('foo bar') == 7 | ||
assert strwidth('あいうえ') == 8 | ||
assert strwidth('fooあい') == 7 | ||
assert util.strwidth('foo bar') == 7 | ||
assert util.strwidth('あいうえ') == 8 | ||
assert util.strwidth('fooあい') == 7 | ||
|
||
def test_truncate(): | ||
assert truncate('foo bar', 3) == 'foo' | ||
assert truncate('fooあい', 5) == 'fooあ' | ||
assert truncate('あいうえ', 4) == 'あい' | ||
assert truncate('fooあい', 4) == 'foo' | ||
assert util.truncate('foo bar', 3) == 'foo' | ||
assert util.truncate('fooあい', 5) == 'fooあ' | ||
assert util.truncate('あいうえ', 4) == 'あい' | ||
assert util.truncate('fooあい', 4) == 'foo' | ||
|
||
def test_skipping(): | ||
assert truncate_skipping('foo bar', 3, '..', 3) == '..bar' | ||
assert truncate_skipping('foo bar', 6, '..', 3) == 'f..bar' | ||
assert truncate_skipping('fooあい', 5, '..', 3) == 'f..い' | ||
assert truncate_skipping('あいうえ', 6, '..', 2) == 'あ..え' | ||
assert util.truncate_skipping('foo bar', 3, '..', 3) == '..bar' | ||
assert util.truncate_skipping('foo bar', 6, '..', 3) == 'f..bar' | ||
assert util.truncate_skipping('fooあい', 5, '..', 3) == 'f..い' | ||
assert util.truncate_skipping('あいうえ', 6, '..', 2) == 'あ..え' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters