def test_convert_date(self): """ Method checks convert string to date. Test with correct data. :return: """ self.assertEqual(convert_to_date("2015-11-03 13:21:02.071381", FORMAT_DATETIME), date(2015, 11, 3)) self.assertEqual(convert_to_date("03.11.2015", FORMAT_CALENDAR), date(2015, 11, 3))
def test_convert_date_error(self): """ Method checks convert string to date. Test with wrong data. :return: """ try: convert_to_date("N/A", FORMAT_CALENDAR) except ValueError as error: self.assertEqual(type(error), ValueError)