Example #1
0
 def test_wrong_state(self):
     with self.assertRaises(ValueError) as context:
         ParseAge.parse(['oldnew', '5d', '4h'])
     self.assertTrue("Wrong or missing state, only older/newer is allowed"
                     in str(context.exception))
Example #2
0
 def test_invalid_unit(self):
     with self.assertRaises(ValueError) as context:
         ParseAge.parse(['older', '5', '4x'])
     self.assertTrue("Invalid unit" in str(context.exception))
Example #3
0
    def test_missing_relative_age(self):

        with self.assertRaises(ValueError) as context:
            ParseAge.parse(['newer'])
        self.assertTrue("Missing arguments" in str(context.exception))