Beispiel #1
0
 def test_generator(self):
     u"""
     Teste du générateur:
         doit retourner une chaîne unicode.
     """
     obj = Phrases()
     text = obj.next()
     self.assertIsInstance(text, unicode)
Beispiel #2
0
#!/usr/bin/env python
# coding: utf-8
u"""
mocks.enneagon : script de démo

Affiche 5 phrases
"""

# -----------------------------------------------------------------------------
# chemin de recherche
import sys
from os.path import abspath, dirname
unitdir = dirname(abspath(dirname(__file__)))
if not unitdir in sys.path: sys.path.insert(0,unitdir)
# -----------------------------------------------------------------------------

from enneagon import Phrases

if __name__ == '__main__':
    from textwrap import wrap
    phrases = Phrases()
    for x in xrange(5):
        text = phrases.next()
        print "# %d" % x
        print "\n".join(wrap(text, initial_indent="  ", subsequent_indent="  "))