plint

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

test_disjunct.py (1307B)


      1 import unittest
      2 
      3 from plint.tests.test_counts import Counts
      4 
      5 
      6 class Disjunct(Counts):
      7     # inspired by Grevisse, Le Bon usage, 14th ed., paragraphs 49-50
      8     d = {
      9         "hiérarchie": 4,
     10         "yeux": 1,
     11         "yeuse": 1,
     12         "yodel": 3,
     13         "yacht": 2,
     14         "York": 1,
     15         "yole": 2,
     16         "Yourcenar": 4,
     17         "Yvelines": 3,
     18         "Ypres": 1,
     19         "ypérite": 3,
     20         "Ysaÿe": 3,
     21         "Ionesco": 4,
     22         "Yahvé": 3,
     23         "Yungfrau": 3,
     24         "yodler": 3,
     25         "oui": 2,
     26         "ouïe": 2,
     27         "ouïr": 2,
     28         "ouest": 1,
     29         "Ouagadougou": 6,
     30         "oisif": 2,
     31         "huis": 2,
     32         "huit": 2,
     33         "huissier": 2,
     34         "uhlan": 3,
     35         "ululer": 4,
     36         "ululement": 5,
     37         "onze": 2,
     38         "onzième": 3,
     39         # both are possible for 'un' and 'une'
     40         "Un": 2,
     41         "un": 2,
     42         "Une": 2,
     43         "une": 1,
     44         # too weird to figure out correct counts in poems
     45         # "Yolande"
     46         # "ouistiti"
     47     }
     48 
     49     def testDisjunct(self):
     50         for k in self.d.keys():
     51             v = self.d[k] + 1
     52             vv = "belle " + k
     53             possible = self.runCount(vv, limit=v)
     54             self.assertTrue(self.achievesPossibility(possible, v))
     55 
     56 
     57 if __name__ == "__main__":
     58     unittest.main()