Coverage for test/use_case/test_saxia.py: 62%
160 statements
« prev ^ index » next coverage.py v7.9.1, created at 2026-02-10 01:10 +0100
« prev ^ index » next coverage.py v7.9.1, created at 2026-02-10 01:10 +0100
1# first test extractia
2import json
3import logging
4import shutil
6from test.main_test import lss_singleton, lpgss_singleton, project_nrt
7from test.main_test import nrt_user_id
8nrt_project_config_saxia_id = 2 # not used brrr
9lss_singleton.user_id = nrt_user_id
11def test_saxia_step():
12 from lib.stockage.lib_pg_safia_sys import LibPGSafiaSys
13 from test.main_test import lpgss_singleton, project_nrt
15 assert True
18#pytest test/use_case/test_saxia.py::test_lib_formal_conf
20def test_lib_formal_conf():
21 #from lib.stockage.lib_pg_safia_sys import LibPGSafiaSys
23 logger = logging.getLogger()
24 print("test_lib_formal_conf")
25 logger.info("info test_lib_formal_conf")
27 lss = None
29 # TODO when project_id is absent, get it from default project_id
31 conf_to_instantiate = {
32 "result": {
33 "type": "format.string",
34 "format": "Hello doctor {customer_name}, Please find here <a href='https://safia.app/saxia/suivi?id_file={id_file}' >{id_file}</a> the result of your folder !\nSaxia Team\nIntros : {intros}\n Feel free to unsubcribe by clicking here or answering this email {mail_lab_team}.",
35 "variables": {
36 "id_file": {
37 "name": "id_file",
38 "type": "safia.datou.io",
39 "key": "id_file"
40 },
41 "intros": {
42 "name": "intros",
43 "type": "safia.datou.io",
44 "key": "result"
45 },
46 "customer_name": {
47 "name": "customer_name",
48 "type": "saxia.config.user",
49 "key": "mail",
50 "todo": "fill_name"
51 },
52 "mail_lab_team": {
53 "name": "mail_lab_team",
54 "type": "saxia.config.project",
55 "key": "saxia.mail_lab_team",
56 "default_should_be_loaded_project_id": 1
57 }
58 }
59 },
60 "input_saxia_step_52_consolidate_1124": {
61 "body": {
62 "type": "format.string",
63 "format": "Thank you for your collaboration.\n Here is a link to your result http://safia.app/{out_folder}/{out_file}",
64 "variables": {
65 "time": "To be computed",
66 "out_file": {
67 "key": "out_file",
68 "type": "safia.audit.col",
69 "col_source": "info_back"
70 },
71 "email_from": "doc@safia.app",
72 "out_folder": {
73 "key": "out_folder",
74 "type": "safia.audit.col",
75 "col_source": "info_back"
76 }
77 }
78 },
79 "object": {
80 "type": "format.string",
81 "format": "Your folder {id_file} is done",
82 "variables": {
83 "id_file": {
84 "type": "safia.audit.col",
85 "col_source": "id_file"
86 }
87 }
88 },
89 "from_mail_to_send": "victor@reutenauer.eu"
90 },
91 "comms": {
92 "type": "exec.func",
93 "func": "extract.df.col",
94 "df": {
95 "type": "exec.func",
96 "func": "load.df.fromjsonasstring",
97 "df_as_json": {
98 "type": "safia.audit.col",
99 "col_source": "audit_info",
100 "key_not_user": "comms",
101 "key_nrt": "io_exec/5/output/df_complet_as_json",
102 "key": "io_exec/9/output/df_complet_as_json",
103 "key_glob": "io_exec/9/output/df_complet_as_json",
104 "extract": "dataframe",
105 "hit": "",
106 "hit_not_used": "current_treatment_or_treatment_consolidate"
107 }
108 },
109 "col": "Commentaires"
110 },
111 "custom_display" : {"saxia_suivi" : { "quick": {
112 "saxia.config.project": {
113 "project_id": 2
114 }
115 }
116 }
117 }
118}
121# select length((audit_info->'io_exec'->'9'->'output'->'df_complet_as_json')::text) from mtraudit.mtr_datou_exec where id=3499;
122 hit_non_reg = "773662aec2cc97d15c403fed93fa94ca0104c05e6026f561fc35354471161ce5"
123 hit_non_reg = "35ec54b83479d0fb842df967d9deef2d0f8586d41306563753e2f46d8600da32" # id 3518
124 hit_non_reg = "4764c3898cd92a361a23b2ba72df7828bd254d14bcefb2ac6d8ac94ca4c290fc" # id 3499
125 # 1/12 to debug why the latest email just add the list of row
126 # https://safia.app/api/v1/manax/comms/load?hash_id_treatment=8e91e1dd1800974a9ca2d38b3a227ff5f98ed1e690987d01e017825e9efe3e57
127 # and also sandbox to display better all of this
128 # hit_non_reg = "8e91e1dd1800974a9ca2d38b3a227ff5f98ed1e690987d01e017825e9efe3e57"
129 print(str(conf_to_instantiate))
130 from lib.util.lib_formal_conf import formal_conf_aux
132 io_datou_exec = {"id_file":"id_666_nb_13_d_20140906"}
134 try:
135 instantiated_conf = formal_conf_aux(conf_to_instantiate, lss_singleton, io_datou_exec,
136 hit = hit_non_reg)
137 except Exception as e:
138 print(str(e))
139 instantiated_conf = {}
140 print(str(instantiated_conf))
142 print(str(instantiated_conf))
143 logger.info(str(instantiated_conf))
145 if "comms" in instantiated_conf:
146 comms = instantiated_conf["comms"]
147 comms_non_reg = """Doc id : 0 : Basé sur les informations disponibles, il semble que la page 1 soit une ordonnance de sortie.\nDoc id : 1 : La page 4 est une feuille de soins, qui sert de document administratif pour le remboursement par la sécurité sociale et les assurances.\nLa spécialité du médecin n'est pas indiquée dans le document.\nDoc id : 2 : La page 2 semble être un rapport distinct d’un laboratoire de biologie médicale.\nDoc id : 3 : La page 3 apparaît comme un courrier envoyé à un participant d'une étude clinique relatant des résultats d'analyse.\nLes informations spécifiées dans les consignes ne sont pas présentes dans l'extrait fourni. Pas de date d'examen, pas de nom ni spécialité de médecin, pas d'indication d'examen ou de chirurgie. Le document semble être une lettre d'information liée à une participation à une étude de recherche et ne correspond à aucun des types de documents énumérés pour extraction.\nDoc id : 4 : \nDoc id : 5 : \nDoc id : 6 : \nDoc id : 7 : \nDoc id : 8 : \n"""
149 les_comms_str = comms
150 assert les_comms_str == comms_non_reg
152 # pour simpligier le test assert a la fin
153 del instantiated_conf["comms"]
155 data_to_use_later = """
156 FORMER CORRECT NON REG result_before_regression in 2025
157 "Hello doctor victor@reutenauer.eu, Please find here <a href='https://safia.app/saxia/suivi?id_file=id_666_nb_13_d_20140906' >id_666_nb_13_d_20140906</a> the result of your folder !\nSaxia Team\nIntros : {}\n Feel free to unsubcribe by clicking here or answering this email None.",
158 """
160 instantiated_conf_ref = {
161 "result": "Hello doctor melvic, Please find here <a href='https://safia.app/saxia/suivi?id_file=id_666_nb_13_d_20140906' >id_666_nb_13_d_20140906</a> the result of your folder !\nSaxia Team\nIntros : {}\n Feel free to unsubcribe by clicking here or answering this email None.",
162 "input_saxia_step_52_consolidate_1124": {'body': 'Thank you for your collaboration.\n Here is a link to your result http://safia.app/temp/id_0_nb_4_d_20260206_4764c3898cd92a361a23b2ba72df7828bd254d14bcefb2ac6d8ac94ca4c290fc.docx', 'object': 'Your folder id_0_nb_4_d_20260206 is done', 'from_mail_to_send': 'victor@reutenauer.eu'},
163 "custom_display": {"saxia_suivi": {"quick": {
164 "condition": [
165 {
166 "value": 40,
167 "variable": "mtr_datou_id",
168 "data_type": "int"
169 }
170 ],
171 "list_col_display": [
172 "id_file",
173 "nb_page",
174 "project_id",
175 "user_id"
176 ],
177 "list_col_virtual": {
178 "result_auto": {
179 "type": "link_format",
180 "format": "/{out_folder}/{out_file}",
181 "variables": {
182 "out_file": {
183 "key": "out_file",
184 "col_source": "info_back"
185 },
186 "out_folder": {
187 "key": "out_folder",
188 "col_source": "info_back"
189 }
190 },
191 "col_source": "info_back"
192 },
193 "feedback_text": {
194 "key": "feedback",
195 "col_source": "info_customer"
196 },
197 "result_correct": {
198 "type": "link_format",
199 "format": "/{out_folder}/{outfile_name_docx}",
200 "variables": {
201 "out_folder": {
202 "key": "out_folder",
203 "col_source": "info_consolidate"
204 },
205 "outfile_name_docx": {
206 "key": "outfile_name_docx",
207 "col_source": "info_consolidate"
208 }
209 },
210 "col_source": "info_back"
211 },
212 "Date d'expertise": {
213 "key": "filename_at",
214 "col_source": "info_date"
215 }
216 }
217 }
218 }
219 }
220}
222 if instantiated_conf == """Hello doctor victor@reutenauer.eu, Please find here <a href='https://safia.app/saxia/suivi?id_file=id_666_nb_13_d_20140906' >id_666_nb_13_d_20140906</a> the result of your folder !
223 Saxia Team
224 Intros : {}
225 Feel free to unsubcribe by clicking here or answering this email None.""":
226 print("change will make test fail")
228 assert instantiated_conf_ref["input_saxia_step_52_consolidate_1124"] == instantiated_conf["input_saxia_step_52_consolidate_1124"]
229 assert instantiated_conf_ref["result"] == instantiated_conf["result"]
231 datou = lss_singleton.get_datou(id=40, instantiate_config_prepare = True,
232 project_id = project_nrt)
234 assert len(datou) == 1
236 datou_40 = datou[0]
237 param_configured_prepare_not_exec_send_mail = datou_40["steps"][-1]["param_json"]
239 # mtr_mba 1-12 A mon avis ce sera ce qu'il faudra faire quand on aura mis à jour mtr_nrt sur melvin, ie avec la version suivante du datou 40, mais il y aura d'autres évolutions aussi
240 # - [x] je pense que cela a été fai
241 param_configured_prepare_not_exec_send_mail_ref = {"assoc": {"id_filee": "object", "result": "result_ro_override"}, "from_mail_to_send": "victor@reutenauer.eu", "from_mail_to_send_activate": "doc@saxia.app", "hash_id_treatment": "", "info_auth": "", "input_for_lfc_from_pj": {"result": {"format": "Hello doctor {customer_name}, Please find here <a href='https://safia.app/saxia/suivi?id_file={id_file}' >{id_file}</a> the result of your folder !\nSaxia Team\n Split : {split}\nIntros : {intros} and\n{comms}\n Feel free to unsubcribe by clicking here or answering this email {mail_lab_team}.", "type": "format.string", "variables": {
242 "customer_name": "victor@reutenauer.eu", "id_file": {"key": "id_file", "name": "id_file", "type": "safia.datou.io"}, "intros": {"key": "result", "name": "intros", "type": "safia.datou.io"}, "comms": {"type": "exec.func", "func": "extract.df.col", "df": {"type": "exec.func", "func": "load.df.fromjsonasstring", "df_as_json": {"type": "safia.audit.col", "col_source": "audit_info", "key_not_user": "comms", "key": "io_exec/5/output/df_complet_as_json", "key_rel": "io_exec/9/output/df_complet_as_json", "extract": "dataframe", "hit": "", "hit_not_used": "current_treatment_or_treatment_consolidate"}}, "col": "Commentaires"},
243 "mail_lab_team": None,
244 "customer_name2": {"type": "saxia.config.user", "key": "mail"},
245 "project_id": {"type": "saxia.config.project", "key": "project_id"}
246 }}}, "privacy": ""}
249# Supprimé d'en dessous
250# 'audit_info': {'col_name': 'info_anon', 'list_keys': ['file']},
252 # mtr_melvin 30-11 : modifié 15/12/24
253 param_configured_prepare_not_exec_send_mail_ref = {
254 "assoc": {
255 "id_filee": "object",
256 "result": "result_ro_override"
257 },
258 "from_mail_to_send": "victor@reutenauer.eu",
259 "from_mail_to_send_activate": "doc@saxia.app",
260 "hash_id_treatment": "",
261 "info_auth": "",
262 "input_for_lfc_from_pj": {
263 "result": {
264 "format": "Hello doctor {customer_name}, Please find here <a href='https://safia.app/saxia/suivi?id_file={id_file}' >{id_file}</a> the result of your folder !\nSaxia Team\nIntros : {intros}\n Feel free to unsubcribe by clicking here or answering this email {mail_lab_team}.",
265 "type": "format.string",
266 "variables": {
267 "customer_name": "victor@reutenauer.eu",
268 "id_file": {
269 "key": "id_file",
270 "name": "id_file",
271 "type": "safia.datou.io"
272 },
273 "intros": {
274 "key": "result",
275 "name": "intros",
276 "type": "safia.datou.io"
277 },
278 "mail_lab_team": None
279 }
280 }
281 },
282 "privacy": ""
283}
285 assert param_configured_prepare_not_exec_send_mail == param_configured_prepare_not_exec_send_mail_ref
287 input_test_exec_var = {"data":{"type":"exec.func", "func":"var",
288 "sub_type":"arr", # ou dict
289 "key_ext" : "intro",
290 "key_int" : "",
291 "key_or_data" : True, # on pourrait utiliser key pour arr et data pour dict
292 "lang":"[intro/VAR]", # intro/VAR/desc
293 "input" : {"type":"saxia.config.project", "project_id":3, "key":"saxia/format/info_format_intro/format"}}
294 }
296 output_test_exec_var_ref = {'data': ['test', 'autre', 'cr_exam', 'default', 'facture', 'courrier', 'certif_at', 'cr_hospit', 'cr_urgence', 'ordonnance', 'attestation', 'cr_operation', 'certif_medical', 'certif_blessure', 'cr_consultation', 'rapport_expertise', 'courrier_manuscrit', 'ordonnance_manuscrit', 'ordonnance_medicament_exception']}
298 try:
299 output_test_exec_var = formal_conf_aux(input_test_exec_var)
300 except Exception as e:
301 print(str(e))
302 instantiated_conf = {}
303 print(str(instantiated_conf))
305 assert output_test_exec_var == output_test_exec_var_ref
306 print("Done")
308def test_enchaine():
309 logger = logging.getLogger()
310 in_file = "test/io/anon_id_3_nb_1_d_20240803.pdf"
311 mtr_datou_id = 46
312 mtr_datou_id_extract = 40
313 limit = 10
316 from test.main_test import lpgss_singleton, project_nrt
317 from lib.batch.lib_batch import run_batch_datou, create_pandas_table_from_text
319 safia_project_id = project_nrt
320 verbose = False
321 from uuid import uuid4
322 with_audit = True
323 limit = 10
324 offset = 0
326 # On pourrait donner un nom de fichier unique avec un uuid
327 # On pourrait chercher le dernier traitement en 40
328 # On pourrait aussi nettoyer la base ! (ou nettoyer les vieux trucs de plus d'un jour)
330 import random
331 id_rand = random.randint(0, 1000)
332 id_file_basename = "id_" + str(id_rand) + "_nb_1_d_20240803.pdf"
333 import os
334 in_file_temp = os.path.join("test/io", id_file_basename)
335 print(" in_file_temp : " + str(in_file_temp))
336 logger.info(" in_file_temp : " + str(in_file_temp))
337 shutil.copyfile(in_file, in_file_temp)
339 out_folder = "test/data/output"
341 ret = run_batch_datou(mtr_datou_id, safia_project_id=safia_project_id,
342 verbose=verbose, with_audit=with_audit,
343 lpgss=lpgss_singleton, in_file=in_file_temp,
344 nb_lines=limit, offset=offset, out_folder=out_folder)
345 print(" ret : " + str(ret))
346 logger.info(" ret : " + str(ret))
348 assert ret != None
349 assert "hash_id_treatment" in ret
350 hit_run = ret["hash_id_treatment"]
351 print(" hit_run : " + str(hit_run))
352 logger.info(" hit_run : " + str(hit_run))
354 all_data = lpgss_singleton.load_data_audit(hit_run)
355 print(" all_data : " + str(all_data))
356 logger.info(" all_data : " + str(all_data))
358# assert all_data != None
359# assert len(all_data) == 1
360# assert "mtr_datou_id" in all_data
361# assert mtr_datou_id = all_data["mtr_datou_id"]
363 condition = {
364 "value": mtr_datou_id_extract,
365 "variable": "mtr_datou_id",
366 "data_type": "int"
367 }
368 all_data = lpgss_singleton.load_data_audit(condition=[condition], limit=limit)
370 for data in all_data:
371 if "id_file" in data:
372 if data["id_file"] == id_file_basename:
373 print("Found id_file_basename " + id_file_basename)
374 logger.info(" data : " + str(data))
376 assert data != None
377 assert "info_anon" in data
378 assert "file" in data["info_anon"]
379 else:
380 logger.info(" MISSING data : " + str(data))
381 print(" MISSING data : " + str(data))
383 res_docx = os.path.join("temp", hit_run + ".docx")
385 import os
386 from docx import Document
387 print(" res_docx : " + str(res_docx))
388 logger.info(" res_docx : " + str(res_docx))
389 if os.path.exists(res_docx):
390 doc = Document(res_docx)
391 text = ""
392 for para in doc.paragraphs:
393 text += para.text
394 print(" text : " + str(text))
395 logger.info(" text : " + str(text))
397 text_ref = "Le 1er juillet 2020, compte rendu opératoire du Docteur Pr P. BOILEAU, chirurgien orthopédique :« DIAGNOSTIC Séquelles ostéochondrite du condyle interne du genou gauche / ATCD de Pridie X 2INDICATION Prothèse uni compartimentale du genou gauche (avec déformation frontale inférieure 10°) (ZUK (Zimmer)).INSTALLATION: Décubitus dorsalVOIES D'ABORDS: Antéro-interne avec garrot (52 minutes)INTERVENTION.Conservation du paquet adipeux.Temps tibial mise en place du guide de coupe tibiale et réalisation d'une coupe tibiale emportant environ 4mm d'os. On prend bien soin de protéger le ligament croisé antérieur. Mise en place d'un implant d'essai taille 5. Vérification qu'il nom une petite laxité de sécurité au niveau interne. Ia languette de 2 mm s'interpose sans problème entre les 2 composants fémoraux et tibiaux.Temps femoral mise en place du guide de coupe fémorale et réalisation d'une coupe fémorale distale. Mise en place d'un composant femoral taille 5Scellement des implants définitifs, avec un composant fémoral taille E, un composant tibial tailles et un polyéthylène de 9mm d'épaisseur. La prothèse est scellée au Palacos Gentamycine. Vérification de la mobilité:. Lavage abondant. Fermeture plan par plan sur redon en aspiration et agrafes sur la peau.Glace sur le genou. Traitement antalgique et anti-inflammatoire pendant 15 jours. Immobilisation dans une attelle de Zimmer. Ablation des agrafes au 15ème jour. Marche avec appui total autorisé. Récupération des amplitudes articulaires sans restriction. Balnéothérapie dès cicatrisation. Aucun travail avec des poids et aucune pouliethérapie ne sont autorisés. Renforcement du quadriceps et des ischio-jambiers en chaîne cinétique fermée à partir du 45ème jour post-opératoire. Attelle à supprimer dès verrouillage du quadriceps.Consultation avec le médecin rééducateur dans le service au 45ème et 90ème jour post-opératoire avec des radiographies du genou de face et de profil en appui monopodal et an défilé fémoro-patellaire.Consultation avec le Pr nom 6ème mois postopératoire avec le même bilan radiographique plus un statigramme des 2 membres inférieurs.Codes Diagnostic M87.08Codes CCAM: NFKA007 »"
399 assert text != None
400 assert len(text) > 0
401 assert text == text_ref
402 else :
403 print(" res_docx " + str(res_docx) + " not found ! ")
406 print(" Need to clean with shutil.rmtree(in_file_temp) if test valider c'est à dire passe une fois ")
407 logger.info(" Need to clean with shutil.rmtree(in_file_temp) if test valider c'est à dire passe une fois ")
408 # shutil.rmtree(in_file_temp)
411def te_st_consolidate():
412 hit_input = "877d31db7c5feae83578b9ced8aafe9121670487bd639078b0733f30b4de98d0"
413 logger = logging.getLogger()
414 input_datou = {'text': None,
415 'hash_id_treatment_input': hit_input,
416 'out_folder': 'static/user_data/ghtest',
417 'input_col_cr': 'cr_correct_typo',
418 'input_col_intro': 'intro_correct_typo',
419 'load_df_from_db_and_correct': 'true',
420 'safia_suivi_prod_doc_id': 'suivi_virtual',
421 'safia_suivi_prod_proj_id': '2',
422 'file': 'None',
423 'out_file': '877d31db7c5feae83578b9ced8aafe9121670487bd639078b0733f30b4de98d0.docx',
424 'project_id': 2}
425# / , 'hash_id_treatment': '2866b62afc48caf12174cb55137662363e2018c92ca623ffd5d518c774e2a43e'
426 import os
427 res_docx = os.path.join("static/user_data/ghtest/", hit_input + ".docx")
429 if os.path.exists(res_docx):
430 os.unlink(res_docx)
432 mtr_datou_id = 44
433 datou = lss_singleton.get_datou(id=mtr_datou_id, instantiate_config_prepare=True)
435 datou = datou[0]
437 list_actions_datou = ["format"]
438 list_param_json = list(map(lambda x: x["param_json"], datou["steps"]))
439 complete_param_json = {}
441 from lib.datou.datou_exec import datou_exec
442 result, audit_json = datou_exec(list_actions_datou, input_datou, complete_param_json,
443 list_param_json_steps = list_param_json)
445 print(" ret : " + str(result))
446 logger.info(" ret : " + str(result))
448 assert result != None
449 assert "hash_id_treatment" in result
450 hit_run = result["hash_id_treatment"]
451 print(" hit_run : " + str(hit_run))
452 logger.info(" hit_run : " + str(hit_run))
454 import os
455 from docx import Document
456 doc = Document(res_docx)
457 text = ""
458 for para in doc.paragraphs:
459 text += para.text
460 print(" text : " + str(text))
461 logger.info(" text : " + str(text))
463 text_ref = "Le 1er juillet 2020, compte rendu opératoire du Docteur Pr P. BOILEAU, chirurgien orthopédique :« DIAGNOSTIC Séquelles ostéochondrite du condyle interne du genou gauche / ATCD de Pridie X 2INDICATION Prothèse uni compartimentale du genou gauche (avec déformation frontale inférieure 10°) (ZUK (Zimmer)).INSTALLATION: Décubitus dorsalVOIES D'ABORDS: Antéro-interne avec garrot (52 minutes)INTERVENTION.Conservation du paquet adipeux.Temps tibial mise en place du guide de coupe tibiale et réalisation d'une coupe tibiale emportant environ 4mm d'os. On prend bien soin de protéger le ligament croisé antérieur. Mise en place d'un implant d'essai taille 5. Vérification qu'il nom une petite laxité de sécurité au niveau interne. Ia languette de 2 mm s'interpose sans problème entre les 2 composants fémoraux et tibiaux.Temps femoral mise en place du guide de coupe fémorale et réalisation d'une coupe fémorale distale. Mise en place d'un composant femoral taille 5Scellement des implants définitifs, avec un composant fémoral taille E, un composant tibial tailles et un polyéthylène de 9mm d'épaisseur. La prothèse est scellée au Palacos Gentamycine. Vérification de la mobilité:. Lavage abondant. Fermeture plan par plan sur redon en aspiration et agrafes sur la peau.Glace sur le genou. Traitement antalgique et anti-inflammatoire pendant 15 jours. Immobilisation dans une attelle de Zimmer. Ablation des agrafes au 15ème jour. Marche avec appui total autorisé. Récupération des amplitudes articulaires sans restriction. Balnéothérapie dès cicatrisation. Aucun travail avec des poids et aucune pouliethérapie ne sont autorisés. Renforcement du quadriceps et des ischio-jambiers en chaîne cinétique fermée à partir du 45ème jour post-opératoire. Attelle à supprimer dès verrouillage du quadriceps.Consultation avec le médecin rééducateur dans le service au 45ème et 90ème jour post-opératoire avec des radiographies du genou de face et de profil en appui monopodal et an défilé fémoro-patellaire.Consultation avec le Pr nom 6ème mois postopératoire avec le même bilan radiographique plus un statigramme des 2 membres inférieurs.Codes Diagnostic M87.08Codes CCAM: NFKA007 »"
465 assert text != None
466 assert len(text) > 0
467 assert text == text_ref