Ejemplo n.º 1
0
 def testAgeInYearNoParam(self):
     person = Person('Ivan Ivanov', date(1901, 1, 1))
     res = person.age_in()
     expect = datetime.now().year - 1901
     self.assertEqual(res, expect)
Ejemplo n.º 2
0
 def testAgeInFloat(self):
     person = Person('Ivan Ivanov', date(1901, 1, 1))
     with self.assertRaises(ValueError):
         person.age_in(1.25)
Ejemplo n.º 3
0
 def testAgeInYearMinus(self):
     person = Person('Ivan Ivanov', date(1901, 1, 1))
     with self.assertRaises(ValueError):
         person.age_in(-1900)
Ejemplo n.º 4
0
 def testAgeIn(self):
     person = Person('Ivan Ivanov', date(1901, 1, 1))
     self.assertEqual(1, person.age_in(1902))