from unittest import TestCase
from datetime import date
from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date


class DetectDate(TestCase):
    def test_detect_date(self):
        dates_to_test = ['10-1990', '09/12/2020', 'jan 1990', 'feb 2012', '9-12-2020']
        res = detect_date(dates_to_test[0])
        self.assertEqual(10, res.month)
        self.assertEqual(1990, res.year)
        res = detect_date(dates_to_test[1])
        self.assertEqual(9, res.month)
        self.assertEqual(2020, res.year)
        res = detect_date(dates_to_test[2])
        self.assertEqual(1, res.month)
        self.assertEqual(1990, res.year)
        res = detect_date(dates_to_test[3])
        self.assertEqual(2, res.month)
        self.assertEqual(2012, res.year)
        res = detect_date(dates_to_test[4])
        self.assertEqual(9, res.month)
        self.assertEqual(2020, res.year)


[((9, 14, 9, 43), 'keras_en_parser_and_analyzer.library.pipmp_my_cv_classify.detect_date', 'detect_date', ({(9, 26, 9, 42): 'dates_to_test[0]'}, {}), '(dates_to_test[0])', False, 'from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date\n'), ((12, 14, 12, 43), 'keras_en_parser_and_analyzer.library.pipmp_my_cv_classify.detect_date', 'detect_date', ({(12, 26, 12, 42): 'dates_to_test[1]'}, {}), '(dates_to_test[1])', False, 'from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date\n'), ((15, 14, 15, 43), 'keras_en_parser_and_analyzer.library.pipmp_my_cv_classify.detect_date', 'detect_date', ({(15, 26, 15, 42): 'dates_to_test[2]'}, {}), '(dates_to_test[2])', False, 'from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date\n'), ((18, 14, 18, 43), 'keras_en_parser_and_analyzer.library.pipmp_my_cv_classify.detect_date', 'detect_date', ({(18, 26, 18, 42): 'dates_to_test[3]'}, {}), '(dates_to_test[3])', False, 'from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date\n'), ((21, 14, 21, 43), 'keras_en_parser_and_analyzer.library.pipmp_my_cv_classify.detect_date', 'detect_date', ({(21, 26, 21, 42): 'dates_to_test[4]'}, {}), '(dates_to_test[4])', False, 'from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date\n')]