|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# pylint: disable=R0201, R0903 |
|
3
|
|
|
|
|
4
|
|
|
"""HTML Model unit tests.""" |
|
5
|
|
|
|
|
6
|
|
|
import pytest |
|
7
|
|
|
|
|
8
|
|
|
from loglan_db.model import Type, Author, Key, Event |
|
9
|
|
|
from loglan_db.model_html import HTMLExportWord as Word, HTMLExportDefinition as Definition |
|
10
|
|
|
from tests.data import definitions, words, types, authors, events |
|
11
|
|
|
from tests.data import word_1, connect_authors, connect_words, keys, connect_keys |
|
12
|
|
|
from tests.functions import db_add_and_return, db_add_objects, db_connect_authors, db_connect_words, db_connect_keys |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
@pytest.mark.usefixtures("db") |
|
16
|
|
|
class TestDefinition: |
|
17
|
|
|
"""Definition tests.""" |
|
18
|
|
|
|
|
19
|
|
|
def test_format_body(self): |
|
20
|
|
|
""" |
|
21
|
|
|
Test formatting definition's body. |
|
22
|
|
|
This method replace some punctuation signs |
|
23
|
|
|
and specific marks with HTML tags. |
|
24
|
|
|
""" |
|
25
|
|
|
string_1 = "<test string>" |
|
26
|
|
|
string_2 = "«test string»" |
|
27
|
|
|
string_3 = "{test string}" |
|
28
|
|
|
string_4 = "test string..." |
|
29
|
|
|
string_5 = "test -- string" |
|
30
|
|
|
|
|
31
|
|
|
assert Definition.format_body(string_1) == "<test string>" |
|
32
|
|
|
assert Definition.format_body(string_2) == "<k>test string</k>" |
|
33
|
|
|
assert Definition.format_body(string_3) == "<l>test string</l>" |
|
34
|
|
|
assert Definition.format_body(string_4) == "test string…" |
|
35
|
|
|
assert Definition.format_body(string_5) == "test — string" |
|
36
|
|
|
|
|
37
|
|
|
def test_highlight_key(self): |
|
38
|
|
|
""" |
|
39
|
|
|
Test highlighting specified key in definition's body. |
|
40
|
|
|
""" |
|
41
|
|
|
def_body = 'K <k>test</k>/<k>examine</k> B for P with test V.' |
|
42
|
|
|
result = Definition.highlight_key(def_body, "test") |
|
43
|
|
|
|
|
44
|
|
|
assert result == "K <k>test</k>/examine B for P with test V." |
|
45
|
|
|
|
|
46
|
|
|
def test_export_for_english(self): |
|
47
|
|
|
"""Test exporting definition as HTML block for E-L Dictionary""" |
|
48
|
|
|
db_add_objects(Word, words) |
|
49
|
|
|
db_add_objects(Type, types) |
|
50
|
|
|
db_add_objects(Definition, definitions) |
|
51
|
|
|
definition = Definition.get_by_id(13527) |
|
52
|
|
|
|
|
53
|
|
|
result = definition.export_for_english(word="test", style="ultra") |
|
54
|
|
|
assert result == "<ld><wn>prukao</wn>, <o><test act></o> <de>[K‍-‍BPV]" \ |
|
55
|
|
|
" (4v) K <k>test</k>/examine B for P with test V.</de></ld>" |
|
56
|
|
|
|
|
57
|
|
|
result = definition.export_for_english(word="test", style="normal") |
|
58
|
|
|
assert result == '<div class="d_line"><span class="w_name">prukao</span>, ' \ |
|
59
|
|
|
'<span class="w_origin"><test act></span> ' \ |
|
60
|
|
|
'<span class="definition eng" id=13527><span class="dt">' \ |
|
61
|
|
|
'[K‍-‍BPV]</span> <span class="dg">(4v)</span>' \ |
|
62
|
|
|
' <span class="db">K <k>test</k>/examine ' \ |
|
63
|
|
|
'B for P with test V.</span></span></div>' |
|
64
|
|
|
|
|
65
|
|
|
def test_export_for_loglan(self): |
|
66
|
|
|
"""Test exporting definition as HTML block for L-E Dictionary""" |
|
67
|
|
|
db_add_objects(Word, words) |
|
68
|
|
|
db_add_objects(Type, types) |
|
69
|
|
|
db_add_objects(Definition, definitions) |
|
70
|
|
|
definition = Definition.get_by_id(13527) |
|
71
|
|
|
|
|
72
|
|
|
result = definition.export_for_loglan(style="ultra") |
|
73
|
|
|
assert result == "<dl>(4v) K <k>test</k>/<k>examine</k> " \ |
|
74
|
|
|
"B for P with test V. [K‍-‍BPV]</dl>" |
|
75
|
|
|
|
|
76
|
|
|
result = definition.export_for_loglan(style="normal") |
|
77
|
|
|
assert result == '<div class="definition log" id=13527><span class="dg">' \ |
|
78
|
|
|
'(4v)</span> <span class="db">K <k>test</k>/' \ |
|
79
|
|
|
'<k>examine</k> B for P with test V.</span> ' \ |
|
80
|
|
|
'<span class="dt">[K‍-‍BPV]</span></div>' |
|
81
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
@pytest.mark.usefixtures("db") |
|
84
|
|
|
class TestWord: |
|
85
|
|
|
"""Word tests.""" |
|
86
|
|
|
|
|
87
|
|
|
def test_html_origin(self): |
|
88
|
|
|
"""Test formatting 'origin' field as HTML block""" |
|
89
|
|
|
word = db_add_and_return(Word, word_1) |
|
90
|
|
|
|
|
91
|
|
|
result = word.html_origin(style="ultra") |
|
92
|
|
|
assert result == "<o><pru(ci)+ka(kt)o=test act></o> " |
|
93
|
|
|
|
|
94
|
|
|
result = word.html_origin(style="normal") |
|
95
|
|
|
assert result == '<span class="m_origin"><pru(ci)+ka(kt)o=test act></span> ' |
|
96
|
|
|
|
|
97
|
|
|
word.origin = None |
|
98
|
|
|
result = word.html_origin() |
|
99
|
|
|
assert result == "<o><test act></o> " |
|
100
|
|
|
|
|
101
|
|
|
word.origin_x = None |
|
102
|
|
|
result = word.html_origin() |
|
103
|
|
|
assert result == "" |
|
104
|
|
|
|
|
105
|
|
|
def test_html_definitions(self): |
|
106
|
|
|
"""Test exporting word's definitions as a list of HTML strings""" |
|
107
|
|
|
db_add_objects(Word, words) |
|
108
|
|
|
db_add_objects(Definition, definitions) |
|
109
|
|
|
word = Word.get_by_id(7315) |
|
110
|
|
|
|
|
111
|
|
|
result = word.html_definitions(style="ultra") |
|
112
|
|
|
assert isinstance(result, list) |
|
113
|
|
|
assert len(result) == 4 |
|
114
|
|
|
assert result[0] == "<dl>(3n) V is a <k>test</k>/<k>examination</k> " \ |
|
115
|
|
|
"for property B in any member of class F. [V‍-‍BF]</dl>" |
|
116
|
|
|
|
|
117
|
|
|
result = word.html_definitions(style="normal") |
|
118
|
|
|
assert isinstance(result, list) |
|
119
|
|
|
assert len(result) == 4 |
|
120
|
|
|
assert result[0] == '<div class="definition log" id=13523><span class="dg">' \ |
|
121
|
|
|
'(3n)</span> <span class="db">V is a <k>test</k>/' \ |
|
122
|
|
|
'<k>examination</k> for property B in any member of class F.' \ |
|
123
|
|
|
'</span> <span class="dt">[V‍-‍BF]</span></div>' |
|
124
|
|
|
|
|
125
|
|
|
def test_meaning(self): |
|
126
|
|
|
"""Test generating data for word's HTML block""" |
|
127
|
|
|
db_add_objects(Word, words) |
|
128
|
|
|
db_add_objects(Type, types) |
|
129
|
|
|
db_add_objects(Author, authors) |
|
130
|
|
|
db_add_objects(Definition, definitions) |
|
131
|
|
|
db_connect_authors(connect_authors) |
|
132
|
|
|
db_connect_words(connect_words) |
|
133
|
|
|
word = Word.get_by_id(7315) |
|
134
|
|
|
|
|
135
|
|
|
result = word.meaning(style="ultra") |
|
136
|
|
|
expected_value = { |
|
137
|
|
|
'mid': 7315, |
|
138
|
|
|
'technical': '<afx>pru</afx> <o><3/4E prove | 2/4C sh yen |' |
|
139
|
|
|
' 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe |' |
|
140
|
|
|
' 2/6J tameshi></o> <tec>49% C-Prim L4 1975 1.9</tec>', |
|
141
|
|
|
'definitions': [ |
|
142
|
|
|
'<dl>(3n) V is a <k>test</k>/<k>examination</k> for property ' |
|
143
|
|
|
'B in any member of class F. [V‍-‍BF]</dl>', |
|
144
|
|
|
'<dl>(vt) <k>test</k>, test for … a property … in a member of ….</dl>', |
|
145
|
|
|
'<dl><du>fu —</du> (a) <k>testable</k>, of classes with -able members.</dl>', |
|
146
|
|
|
'<dl><du>nu —</du> (a) <k>testable</k>, of testable properties.</dl>'], |
|
147
|
|
|
'used_in': '<use>prukao</use>'} |
|
148
|
|
|
assert isinstance(result, dict) |
|
149
|
|
|
assert result == expected_value |
|
150
|
|
|
|
|
151
|
|
|
word = Word.get_by_id(3802) |
|
152
|
|
|
|
|
153
|
|
|
result = word.meaning(style="normal") |
|
154
|
|
|
expected_value = { |
|
155
|
|
|
'mid': 3802, |
|
156
|
|
|
'technical': '<span class="m_origin"><kak(to)></span> <span class="m_technical">' |
|
157
|
|
|
'<span class="m_type">Afx</span> <span class="m_author">JCB</span> ' |
|
158
|
|
|
'<span class="m_year">1988</span> <span class="m_rank">7+</span></span>', |
|
159
|
|
|
'definitions': ['<div class="definition log" id=7240><span class="dg">(af)' |
|
160
|
|
|
'</span> <span class="db">a combining form of ' |
|
161
|
|
|
'<l>kakto</l>, <k>act</k>.</span></div>'], |
|
162
|
|
|
'used_in': None} |
|
163
|
|
|
|
|
164
|
|
|
assert isinstance(result, dict) |
|
165
|
|
|
assert result == expected_value |
|
166
|
|
|
|
|
167
|
|
|
def test_html_meaning(self): |
|
168
|
|
|
db_add_objects(Word, words) |
|
169
|
|
|
db_add_objects(Type, types) |
|
170
|
|
|
db_add_objects(Author, authors) |
|
171
|
|
|
db_add_objects(Definition, definitions) |
|
172
|
|
|
db_connect_authors(connect_authors) |
|
173
|
|
|
db_connect_words(connect_words) |
|
174
|
|
|
word = Word.get_by_id(7315) |
|
175
|
|
|
expected_result_ultra = """<m> |
|
176
|
|
|
<t><afx>pru</afx> <o><3/4E prove | 2/4C sh yen | 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe | 2/6J tameshi></o> <tec>49% C-Prim L4 1975 1.9</tec></t> |
|
177
|
|
|
<ds> |
|
178
|
|
|
<dl>(3n) V is a <k>test</k>/<k>examination</k> for property B in any member of class F. [V‍-‍BF]</dl> |
|
179
|
|
|
<dl>(vt) <k>test</k>, test for … a property … in a member of ….</dl> |
|
180
|
|
|
<dl><du>fu —</du> (a) <k>testable</k>, of classes with -able members.</dl> |
|
181
|
|
|
<dl><du>nu —</du> (a) <k>testable</k>, of testable properties.</dl> |
|
182
|
|
|
</ds> |
|
183
|
|
|
<us>Used In: <use>prukao</use></us> |
|
184
|
|
|
</m>""" |
|
185
|
|
|
result = word.html_meaning(style="ultra") |
|
186
|
|
|
assert result == expected_result_ultra |
|
187
|
|
|
|
|
188
|
|
|
expected_result_normal = """<div class="meaning" id="7315"> |
|
189
|
|
|
<div class="technical"><span class="m_afx">pru</span> <span class="m_origin"><3/4E prove | 2/4C sh yen | 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe | 2/6J tameshi></span> <span class="m_technical"><span class="m_match">49%</span> <span class="m_type">C-Prim</span> <span class="m_author">L4</span> <span class="m_year">1975</span> <span class="m_rank">1.9</span></span></div> |
|
190
|
|
|
<div class="definitions"> |
|
191
|
|
|
<div class="definition log" id=13523><span class="dg">(3n)</span> <span class="db">V is a <k>test</k>/<k>examination</k> for property B in any member of class F.</span> <span class="dt">[V‍-‍BF]</span></div> |
|
192
|
|
|
<div class="definition log" id=13524><span class="dg">(vt)</span> <span class="db"><k>test</k>, test for … a property … in a member of ….</span></div> |
|
193
|
|
|
<div class="definition log" id=13525><span class="du">fu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of classes with -able members.</span></div> |
|
194
|
|
|
<div class="definition log" id=13526><span class="du">nu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of testable properties.</span></div> |
|
195
|
|
|
</div> |
|
196
|
|
|
<div class="used_in">Used In: <span class="m_use">prukao</span></div> |
|
197
|
|
|
</div>""" |
|
198
|
|
|
result = word.html_meaning(style="normal") |
|
199
|
|
|
assert result == expected_result_normal |
|
200
|
|
|
|
|
201
|
|
|
def test_html_all_by_name(self): |
|
202
|
|
|
db_add_objects(Word, words) |
|
203
|
|
|
db_add_objects(Type, types) |
|
204
|
|
|
db_add_objects(Author, authors) |
|
205
|
|
|
db_add_objects(Event, events) |
|
206
|
|
|
db_add_objects(Definition, definitions) |
|
207
|
|
|
db_connect_authors(connect_authors) |
|
208
|
|
|
db_connect_words(connect_words) |
|
209
|
|
|
|
|
210
|
|
|
result = Word.html_all_by_name("buuku", style="ultra") |
|
211
|
|
|
assert result is None |
|
212
|
|
|
|
|
213
|
|
|
expected_result_ultra = """<ws> |
|
214
|
|
|
<w wid="pruci"><wl>pruci,</wl> |
|
215
|
|
|
<ms> |
|
216
|
|
|
<m> |
|
217
|
|
|
<t><afx>pru</afx> <o><3/4E prove | 2/4C sh yen | 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe | 2/6J tameshi></o> <tec>49% C-Prim L4 1975 1.9</tec></t> |
|
218
|
|
|
<ds> |
|
219
|
|
|
<dl>(3n) V is a <k>test</k>/<k>examination</k> for property B in any member of class F. [V‍-‍BF]</dl> |
|
220
|
|
|
<dl>(vt) <k>test</k>, test for … a property … in a member of ….</dl> |
|
221
|
|
|
<dl><du>fu —</du> (a) <k>testable</k>, of classes with -able members.</dl> |
|
222
|
|
|
<dl><du>nu —</du> (a) <k>testable</k>, of testable properties.</dl> |
|
223
|
|
|
</ds> |
|
224
|
|
|
<us>Used In: <use>prukao</use></us> |
|
225
|
|
|
</m> |
|
226
|
|
|
</ms> |
|
227
|
|
|
</w> |
|
228
|
|
|
</ws> |
|
229
|
|
|
""" |
|
230
|
|
|
|
|
231
|
|
|
result = Word.html_all_by_name("pruci", style="ultra") |
|
232
|
|
|
assert result == expected_result_ultra |
|
233
|
|
|
|
|
234
|
|
|
expected_result_normal = """<div class="words"> |
|
235
|
|
|
<div class="word" wid="pruci"> |
|
236
|
|
|
<div class="word_line"><span class="word_name">pruci</span>,</div> |
|
237
|
|
|
<div class="meanings"> |
|
238
|
|
|
<div class="meaning" id="7315"> |
|
239
|
|
|
<div class="technical"><span class="m_afx">pru</span> <span class="m_origin"><3/4E prove | 2/4C sh yen | 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe | 2/6J tameshi></span> <span class="m_technical"><span class="m_match">49%</span> <span class="m_type">C-Prim</span> <span class="m_author">L4</span> <span class="m_year">1975</span> <span class="m_rank">1.9</span></span></div> |
|
240
|
|
|
<div class="definitions"> |
|
241
|
|
|
<div class="definition log" id=13523><span class="dg">(3n)</span> <span class="db">V is a <k>test</k>/<k>examination</k> for property B in any member of class F.</span> <span class="dt">[V‍-‍BF]</span></div> |
|
242
|
|
|
<div class="definition log" id=13524><span class="dg">(vt)</span> <span class="db"><k>test</k>, test for … a property … in a member of ….</span></div> |
|
243
|
|
|
<div class="definition log" id=13525><span class="du">fu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of classes with -able members.</span></div> |
|
244
|
|
|
<div class="definition log" id=13526><span class="du">nu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of testable properties.</span></div> |
|
245
|
|
|
</div> |
|
246
|
|
|
<div class="used_in">Used In: <span class="m_use">prukao</span></div> |
|
247
|
|
|
</div> |
|
248
|
|
|
</div> |
|
249
|
|
|
</div> |
|
250
|
|
|
</div> |
|
251
|
|
|
""" |
|
252
|
|
|
result = Word.html_all_by_name("Pruci", style="normal") |
|
253
|
|
|
assert result == expected_result_normal |
|
254
|
|
|
|
|
255
|
|
|
result = Word.html_all_by_name("pruci", style="normal", event_id=1) |
|
256
|
|
|
assert result == expected_result_normal |
|
257
|
|
|
|
|
258
|
|
|
result = Word.html_all_by_name("Pruci", style="normal", case_sensitive=True) |
|
259
|
|
|
assert result is None |
|
260
|
|
|
|
|
261
|
|
|
expected_result_normal = """<div class="words"> |
|
262
|
|
|
<div class="word" wid="pru"> |
|
263
|
|
|
<div class="word_line"><span class="word_name">pru</span>,</div> |
|
264
|
|
|
<div class="meanings"> |
|
265
|
|
|
<div class="meaning" id="7314"> |
|
266
|
|
|
<div class="technical"><span class="m_origin"><pru(ci)></span> <span class="m_technical"><span class="m_type">Afx</span> <span class="m_author">JCB</span> <span class="m_year">1988</span> <span class="m_rank">7+</span></span></div> |
|
267
|
|
|
<div class="definitions"> |
|
268
|
|
|
<div class="definition log" id=13521><span class="dg">(af)</span> <span class="db">a combining form of <l>pruci</l>, <k>test</k>.</span></div> |
|
269
|
|
|
</div> |
|
270
|
|
|
</div> |
|
271
|
|
|
</div> |
|
272
|
|
|
</div> |
|
273
|
|
|
<div class="word" wid="pruci"> |
|
274
|
|
|
<div class="word_line"><span class="word_name">pruci</span>,</div> |
|
275
|
|
|
<div class="meanings"> |
|
276
|
|
|
<div class="meaning" id="7315"> |
|
277
|
|
|
<div class="technical"><span class="m_afx">pru</span> <span class="m_origin"><3/4E prove | 2/4C sh yen | 3/6S prueba | 2/5R proba | 2/5F epreuve | 2/5G probe | 2/6J tameshi></span> <span class="m_technical"><span class="m_match">49%</span> <span class="m_type">C-Prim</span> <span class="m_author">L4</span> <span class="m_year">1975</span> <span class="m_rank">1.9</span></span></div> |
|
278
|
|
|
<div class="definitions"> |
|
279
|
|
|
<div class="definition log" id=13523><span class="dg">(3n)</span> <span class="db">V is a <k>test</k>/<k>examination</k> for property B in any member of class F.</span> <span class="dt">[V‍-‍BF]</span></div> |
|
280
|
|
|
<div class="definition log" id=13524><span class="dg">(vt)</span> <span class="db"><k>test</k>, test for … a property … in a member of ….</span></div> |
|
281
|
|
|
<div class="definition log" id=13525><span class="du">fu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of classes with -able members.</span></div> |
|
282
|
|
|
<div class="definition log" id=13526><span class="du">nu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of testable properties.</span></div> |
|
283
|
|
|
</div> |
|
284
|
|
|
<div class="used_in">Used In: <span class="m_use">prukao</span></div> |
|
285
|
|
|
</div> |
|
286
|
|
|
</div> |
|
287
|
|
|
</div> |
|
288
|
|
|
<div class="word" wid="prukao"> |
|
289
|
|
|
<div class="word_line"><span class="word_name">prukao</span>,</div> |
|
290
|
|
|
<div class="meanings"> |
|
291
|
|
|
<div class="meaning" id="7316"> |
|
292
|
|
|
<div class="technical"><span class="m_origin"><pru(ci)+ka(kt)o=test act></span> <span class="m_technical"><span class="m_type">2-Cpx</span> <span class="m_author">L4</span> <span class="m_year">1975</span> <span class="m_rank">1.9</span></span></div> |
|
293
|
|
|
<div class="definitions"> |
|
294
|
|
|
<div class="definition log" id=13527><span class="dg">(4v)</span> <span class="db">K <k>test</k>/<k>examine</k> B for P with test V.</span> <span class="dt">[K‍-‍BPV]</span></div> |
|
295
|
|
|
<div class="definition log" id=13528><span class="dg">(n)</span> <span class="db">a <k>tester</k>, one who uses tests.</span></div> |
|
296
|
|
|
<div class="definition log" id=13529><span class="du">nu —</span> <span class="dg">(a)</span> <span class="db"><k>testable</k>, of one who/that which is -ed.</span></div> |
|
297
|
|
|
<div class="definition log" id=13530><span class="du">nu —</span> <span class="dg">(n)</span> <span class="db">a <k>testee</k>, one who is -ed.</span></div> |
|
298
|
|
|
<div class="definition log" id=13531><span class="du">po —</span> <span class="dg">(n)</span> <span class="db">a <k>test</k>/<k>examination</k>, an act of testing.</span></div> |
|
299
|
|
|
</div> |
|
300
|
|
|
</div> |
|
301
|
|
|
</div> |
|
302
|
|
|
</div> |
|
303
|
|
|
</div> |
|
304
|
|
|
""" |
|
305
|
|
|
result = Word.html_all_by_name("pru", style="normal", case_sensitive=True, partial_results=True) |
|
306
|
|
|
assert result == expected_result_normal |
|
307
|
|
|
|
|
308
|
|
|
result = Word.html_all_by_name("Pru", style="normal", case_sensitive=False, partial_results=True) |
|
309
|
|
|
assert result == expected_result_normal |
|
310
|
|
|
|
|
311
|
|
|
def test_translation_by_key(self): |
|
312
|
|
|
db_add_objects(Word, words) |
|
313
|
|
|
db_add_objects(Type, types) |
|
314
|
|
|
db_add_objects(Author, authors) |
|
315
|
|
|
db_add_objects(Key, keys) |
|
316
|
|
|
db_add_objects(Definition, definitions) |
|
317
|
|
|
db_connect_authors(connect_authors) |
|
318
|
|
|
db_connect_words(connect_words) |
|
319
|
|
|
db_connect_keys(connect_keys) |
|
320
|
|
|
|
|
321
|
|
|
expected_result_ultra = """<ld><wn>pru</wn>, <de>(af) a combining form of <l>pruci</l>, <k>test</k>.</de></ld> |
|
322
|
|
|
<ld><wn>pruci</wn>, <de>[V‍-‍BF] (3n) V is a <k>test</k>/examination for property B in any member of class F.</de></ld> |
|
323
|
|
|
<ld><wn>pruci</wn>, <de>(vt) <k>test</k>, test for … a property … in a member of ….</de></ld> |
|
324
|
|
|
<ld><wn>prukao</wn>, <o><test act></o> <de>[K‍-‍BPV] (4v) K <k>test</k>/examine B for P with test V.</de></ld> |
|
325
|
|
|
<ld><wn>po prukao</wn>, <o><test act></o> <de>(n) a <k>test</k>/examination, an act of testing.</de></ld>""" |
|
326
|
|
|
result = Word.translation_by_key("test") |
|
327
|
|
|
assert result == expected_result_ultra |
|
328
|
|
|
|
|
329
|
|
|
expected_result_normal = """<div class="d_line"><span class="w_name">pru</span>, <span class="definition eng" id=13521><span class="dg">(af)</span> <span class="db">a combining form of <l>pruci</l>, <k>test</k>.</span></span></div> |
|
330
|
|
|
<div class="d_line"><span class="w_name">pruci</span>, <span class="definition eng" id=13523><span class="dt">[V‍-‍BF]</span> <span class="dg">(3n)</span> <span class="db">V is a <k>test</k>/examination for property B in any member of class F.</span></span></div> |
|
331
|
|
|
<div class="d_line"><span class="w_name">pruci</span>, <span class="definition eng" id=13524><span class="dg">(vt)</span> <span class="db"><k>test</k>, test for … a property … in a member of ….</span></span></div> |
|
332
|
|
|
<div class="d_line"><span class="w_name">prukao</span>, <span class="w_origin"><test act></span> <span class="definition eng" id=13527><span class="dt">[K‍-‍BPV]</span> <span class="dg">(4v)</span> <span class="db">K <k>test</k>/examine B for P with test V.</span></span></div> |
|
333
|
|
|
<div class="d_line"><span class="w_name">po prukao</span>, <span class="w_origin"><test act></span> <span class="definition eng" id=13531><span class="dg">(n)</span> <span class="db">a <k>test</k>/examination, an act of testing.</span></span></div>""" |
|
334
|
|
|
result = Word.translation_by_key("test", style="normal") |
|
335
|
|
|
assert result == expected_result_normal |
|
336
|
|
|
|
|
337
|
|
|
result = Word.translation_by_key("word_that_does_not_exist") |
|
338
|
|
|
assert result is None |
|
339
|
|
|
|