test_exceptions_count.py (1404B)
1 from _pytest import unittest 2 3 from plint.tests.test_counts import Counts 4 5 6 class ExceptionCounts(Counts): 7 def testPays(self): 8 f = self.runCount("pays abbaye alcoyle", limit=8) 9 self.assertEqual(1, len(f)) 10 self.assertEqual(self.getWeight(f[0]), 8) 11 12 def testPorteAvions(self): 13 f = self.runCount("porte-avions porte-avions", limit=8) 14 self.assertEqual(1, len(f)) 15 self.assertEqual(self.getWeight(f[0]), 8) 16 17 def testSainteHelene(self): 18 # from "Les Trophées", José-Maria de Heredia 19 text = "Le navire, doublant le cap de Sainte-Hélène," 20 f = self.runCount(text, limit=12) 21 self.assertEqual(1, len(f)) 22 self.assertEqual(self.getWeight(f[0]), 12) 23 24 def testHemisticheElide(self): 25 text1 = "Tatata ta verre un tata tatata" 26 text2 = "Tatata tata verre un tata tatata" 27 f1 = self.runCount(text1, limit=12, hemistiches=[6]) 28 self.assertEqual(0, len(f1)) 29 f2 = self.runCount(text2, limit=12, hemistiches=[6]) 30 self.assertEqual(1, len(f2)) 31 self.assertEqual(self.getWeight(f2[0]), 12) 32 33 def testConcluera(self): 34 text = "Concluera l'examen. Venez, je vous invite" 35 f = self.runCount(text, limit=12, hemistiches=[6]) 36 self.assertEqual(1, len(f)) 37 self.assertEqual(self.getWeight(f[0]), 12) 38 39 if __name__ == "__main__": 40 unittest.main()