File: test_candidate.py

package info (click to toggle)
tomoe 0.6.0-1.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 51,408 kB
  • ctags: 29,632
  • sloc: xml: 1,387,627; ansic: 11,515; sh: 9,072; ruby: 1,344; python: 762; makefile: 447
file content (39 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
# encoding: utf-8
import os
import sys
import glob
import unittest
import test_common
import tomoe

class TomoeCandidateTest(unittest.TestCase):

    def testScore(self):
        char_code = '池'
        tomoe_char = tomoe.Char(utf8 = char_code)

        score = 1
        cand = tomoe.Candidate(tomoe_char)
        self.assertEqual(0, cand.get_score())
        cand.set_score(score)
        self.assertEqual(score, cand.get_score())

    def testGetChar(self):
        char_code = '池'
        tomoe_char = tomoe.Char(utf8 = char_code)
        cand = tomoe.Candidate(tomoe_char)
        self.assertEqual(char_code, cand.get_char().get_utf8())

    def testCompare(self):
        char_code = '池'
        tomoe_char1 = tomoe.Char(utf8 = char_code)
        cand1 = tomoe.Candidate(tomoe_char1)
        cand1.set_score(1)
        
        tomoe_char2 = tomoe.Char(utf8 = char_code)
        cand2 = tomoe.Candidate(tomoe_char2)
        cand2.set_score(2)
        self.assert_(cand1.compare(cand2) < 0)


# vi:ts=4:nowrap:ai:expandtab