travis-ci
12906 of 13175 relevant lines covered (97.96%)
1.47 hits per line
1 |
# -*- coding: utf-8 -*-
|
|
2 |
from 臺灣言語工具.解析整理.解析錯誤 import 解析錯誤 |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
3 |
|
|
4 |
|
|
5 |
class 隨前變調: |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
6 |
對應表 = { |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
7 |
'1': '1', '2': '3', '3': '3', '4': '3', |
|
8 |
'5': '7', '7': '7', '8': '3' |
|
9 |
} |
|
10 |
|
|
11 |
def __init__(self, 頂一个調): |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
12 |
self._變調後輕聲音 = self.對應表[頂一个調] |
1 only TOX_ENV=單元試驗 ✔ |
13 |
|
|
14 |
def __eq__(self, 別的): |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
15 |
try:
|
1 only TOX_ENV=單元試驗 ✔ |
16 |
return self._變調後輕聲音 == 別的._變調後輕聲音 |
1 only TOX_ENV=單元試驗 ✔ |
17 |
except AttributeError: |
1 only TOX_ENV=單元試驗 ✔ |
18 |
return False |
1 only TOX_ENV=單元試驗 ✔ |
19 |
|
|
20 |
def 變調(self, 音): |
2 only TOX_ENV=單元試驗 and TOX_ENV=HTS整合試驗 ✔ |
21 |
聲, 韻, 調 = 音 |
1 only TOX_ENV=單元試驗 ✔ |
22 |
if 韻.endswith('p') or 韻.endswith('t') or 韻.endswith('k'): |
1 only TOX_ENV=單元試驗 ✔ |
23 |
raise 解析錯誤('入聲毋知愛按怎隨前變調!!{0}'.format((聲, 韻, 調))) |
1 only TOX_ENV=單元試驗 ✔ |
24 |
return (聲, 韻.rstrip('hʔ'), self._變調後輕聲音) |
1 only TOX_ENV=單元試驗 ✔ |