plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

test_rhyme.py (761B)


      1 import unittest
      2 
      3 from plint.template import Template
      4 
      5 
      6 class TestRhyme(unittest.TestCase):
      7 
      8     def _test_rimes(self):
      9         template = Template("""6/6 A !X
     10 6/6 A !X""")
     11         text = """Je te fais plus parfait mille fois que tu n’es :
     12         Ton feu ne peut aller au point où je le mets ;"""
     13         should_end = False
     14         for line in text.split("\n"):
     15             errors = template.check(line, None, last=should_end, n_syllables=None, offset=0)
     16             self.assertIsNone(errors, errors.report() if errors is not None else "OK")
     17         should_end = True
     18         line = ""
     19         errors = template.check(line, None, last=should_end, n_syllables=None, offset=0)
     20         self.assertIsNone(errors)
     21 
     22 
     23 if __name__ == '__main__':
     24     unittest.main()