Skip to content

Commit

Permalink
Add test for unicode support
Browse files Browse the repository at this point in the history
Close #1
  • Loading branch information
Toilal committed Oct 20, 2015
1 parent 2f6c82d commit d863c8e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions rebulk/test/test_rebulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,28 @@ def then(self, matches, when_response, context):
assert matches[0].value == "word"

assert not matches.markers


class TestUnicode(object):
def test_rebulk_simple(self):
input_string = u"敏捷的棕色狐狸跳過懶狗"

rebulk = Rebulk()

rebulk.string(u"敏")
rebulk.regex(u"捷")

def func(input_string):
i = input_string.find(u"的")
if i > -1:
return i, i + len(u"的")

rebulk.functional(func)

matches = rebulk.matches(input_string)
assert len(matches) == 3

assert matches[0].value == u"敏"
assert matches[1].value == u"捷"
assert matches[2].value == u"的"

0 comments on commit d863c8e

Please sign in to comment.