Add doctests to lookup_term() and terms() functions. - vt - Print definitions from Vocabolario Treccani
(HTM) hg clone https://bitbucket.org/iamleot/vt
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset 140348f2fe25354d1c77a644608fd1769c90d09f
(DIR) parent 5c3fbc584b69b8c79da908cf6749f8f62577fa30
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sun, 13 May 2018 14:27:07
Add doctests to lookup_term() and terms() functions.
print_term() is still missing a test, I am not sure if that can be helpful or
not though to test it as well.
Diffstat:
vt.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff -r 5c3fbc584b69 -r 140348f2fe25 vt.py
--- a/vt.py Sun May 13 14:19:21 2018 +0200
+++ b/vt.py Sun May 13 14:27:07 2018 +0200
@@ -41,6 +41,9 @@
Returns the relevant text output of the term or None if nothing relevant
was found.
+
+ >>> lookup_term('birbante')
+ 'birbante s. m. [der. di birba1]. – Uomo che conduce vita poco onesta, scaltro e insieme malvagio. Spesso detto per scherzo o per affettuoso rimprovero (anche di o a ragazzi) per denotare soprattutto furberia, impertinenza e sim., e con questo sign. estens. è usato anche al femm.: quante me ne combina, quel b. di tuo nipote; quel b. me l’ha fatta; ah, b., t’ho colto finalmente!; quella b. della tua segretaria m’ha detto che non eri in ufficio! ◆ Dim. scherz. birbantèllo (anche al femm., birbantèlla); accr. scherz. birbantàccio.'
"""
url = 'http://www.treccani.it/vocabolario/' + parse.quote(term)
@@ -57,6 +60,9 @@
Given a term return a list of zero or more definition regarding the
term.
+
+ >>> terms('birba')
+ ['birba1 s. f. [etimo incerto]. – Persona priva di scrupoli, cattivo soggetto (sinon., quindi, del più com. birbante): Vostra Eccellenza, che ... mi gabella per anti-tedesco Perché metto le b. alla berlina (Giusti); credeva senza dubbio d’aver da fare con una b. matricolata (Pirandello). Più spesso, con tono scherz., bambino, ragazzino furbo, vispo, impertinente e malizioso: quella b. di mio figlio. Anticam. ebbe anche sign. astratto di malizia, frode, in varie locuz. furbesche. ◆ Dim. scherz. birbétta, birberèlla, birbacchiòlo m. e birbacchiòla f., pegg. birbàccia e più com. birbaccióne m. e birbaccióna f.; v. anche birbone, che è propr. accr. di birba ma è sentito ormai come voce a sé.', 'birba2 s. f. [etimo incerto], region. ant. – Carrozza scoperta a due posti, tirata da due cavalli: Signore, come gli dissi, io son venuto in birba ... E sono venuto con due cavalli (Goldoni).']
"""
ts = []