-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbs_test.py
26 lines (19 loc) · 978 Bytes
/
sbs_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
import unittest
from sbs import Splitter
class TestSplitter(unittest.TestCase):
def setUp(self):
self.t = Splitter()
self.t.load([u"test", u"hest", u"parkering", "billet", "automat", u"universitet", u'forlag'])
def test_we_can_split_to_known_words(self):
self.assertEquals([u"test", u"hest"], self.t.split(u"testhest"))
def test_we_ignore_the_obvious(self):
self.assertEquals(None, self.t.split(u"testr"))
self.assertEquals(None, self.t.split(u"tests"))
def test_we_can_handle_some_conjugations(self):
self.assertEquals([u"test", u"hester"], self.t.split(u"testhester"))
self.assertEquals([u"test", u"hesten"], self.t.split(u"testhesten"))
self.assertEquals([u"testen", u"hesten"], self.t.split(u"testenhesten"))
self.assertEquals([u"parkerings", u"billet", "automat"], self.t.split(u"parkeringsbilletautomat"))
if __name__ == '__main__':
unittest.main()