plint

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

test_sanity_check.py (1609B)


      1 import unittest
      2 
      3 import plint.pattern
      4 from plint import diaeresis, verse, template, common
      5 
      6 
      7 class SanityCheck(unittest.TestCase):
      8 
      9     def testSimple(self):
     10         text = "Hello World!!  This is a test_data"
     11         v = verse.Verse(text, template.Template(), plint.pattern.Pattern("12"))
     12         v.parse()
     13         self.assertEqual(text, v.line)
     14 
     15     def testComplex(self):
     16         text = "Aye AYAYE   aye  gue que geque AYAYAY a prt   sncf bbbéé"
     17         v = verse.Verse(text, template.Template(), plint.pattern.Pattern("12"))
     18         v.parse()
     19         self.assertEqual(text, v.line)
     20 
     21     def testLeadingSpace(self):
     22         text = " a"
     23         v = verse.Verse(text, template.Template(), plint.pattern.Pattern("12"))
     24         v.parse()
     25         self.assertEqual(text, v.line)
     26 
     27     def testLeadingSpaceHyphenVowel(self):
     28         text = " -a"
     29         v = verse.Verse(text, template.Template(), plint.pattern.Pattern("12"))
     30         v.parse()
     31         self.assertEqual(text, v.line)
     32 
     33     def testLeadingSpaceHyphenConsonant(self):
     34         text = " -c"
     35         v = verse.Verse(text, template.Template(), plint.pattern.Pattern("12"))
     36         v.parse()
     37         self.assertEqual(text, v.line)
     38 
     39     def testLoneHyphens(self):
     40         text = " - - -- --   - -  - --"
     41         self.assertEqual(common.normalize(text), "")
     42 
     43     def testOnlyHyphens(self):
     44         text = "-----"
     45         self.assertEqual(common.normalize(text), "")
     46 
     47     def testAspiratedJunk(self):
     48         text = "---''humain"
     49         self.assertEqual(common.normalize(text, rm_all_begin=True), "humain")
     50 
     51 
     52 if __name__ == "__main__":
     53     unittest.main()