def test_pesel_niepoprawny(self):
     self.assertFalse(
         pesel_module.check_pesel('90090525836'),
         "Funkcja nie zwróciła False dla niepoprawnej wartości PESEL")
     self.assertFalse(
         pesel_module.check_pesel('01261031813'),
         "Funkcja nie zwróciła False dla niepoprawnej wartości PESEL")
     self.assertFalse(
         pesel_module.check_pesel('87832165581'),
         "Funkcja nie zwróciła False dla niepoprawnej wartości PESEL")
 def do_test_pesel(self, pesel):
     with capture_stdout() as out:
         ok = pesel_module.check_pesel(pesel)
     self.assertTrue(
         ok, "Funkcja nie zwróciła True dla poprawnej wartości PESEL")
     birthday = out.getvalue().strip()
     if birthday.startswith('0'): birthday = birthday[1:]
     month = int(pesel[2:4])
     year = int(pesel[0:2])
     century = month // 20
     if century == 4:
         year += 1800
     else:
         year += 1900 + 100 * century
     self.assertEqual(
         birthday.lower(),
         f"{int(pesel[4:6])} {self._months[(month%20)-1]} {year}",
         "Funkcja nie wydrukowała daty urodzenia według wskazanego formatu")
 def test_pesel_zbyt_krótki(self):
     self.assertFalse(
         pesel_module.check_pesel('123456789'),
         "Funkcja nie zwróciła False dla niepoprawnej i zbyt krótkiej wartości PESEL"
     )
Example #4
0
 def test_pesel_too_short(self):
     self.assertIsNone(pesel.check_pesel('123456789'))
Example #5
0
 def test_pesel_incorrect(self):
     self.assertIsNone(pesel.check_pesel('90090525836'))
     self.assertIsNone(pesel.check_pesel('01261031813'))
     self.assertIsNone(pesel.check_pesel('87832165581'))
Example #6
0
 def test_pesel_correct_19th_century(self):
     self.assertEqual(pesel.check_pesel('87832165181'), 'March 21, 1887')
Example #7
0
 def test_pesel_correct_21st_century(self):
     self.assertEqual(pesel.check_pesel('01261051813'), 'June 10, 2001')
Example #8
0
 def test_pesel_correct_20th_century(self):
     self.assertEqual(pesel.check_pesel('90090515836'), 'September 5, 1990')