コード例 #1
0
    def test__format_date_ok(self):
        '''
        test _format_date with valid format
        '''

        ret = cleanup_clicrdv._format_date('20180621')
        self.assertEquals(ret, datetime.date(2018, 6, 21))
コード例 #2
0
    def test__format_date_year_only(self):
        '''
        test _format_date with year only
        '''

        ret = cleanup_clicrdv._format_date('2017')
        self.assertEquals(ret, datetime.date(2017, 1, 1))
コード例 #3
0
 def test__format_date_invalid_day_format(self):
     '''
     test _format_date with invalid day format
     '''
     ret = cleanup_clicrdv._format_date('201806yz')
     self.assertEquals(ret, None)
     output = sys.stdout.getvalue().strip()
     self.assertEquals(output, 'Invalid day format : yz')
コード例 #4
0
 def test__format_date_invalid_month_range(self):
     '''
     test _format_date with invalid month range
     '''
     ret = cleanup_clicrdv._format_date('20182106')
     self.assertEquals(ret, None)
     output = sys.stdout.getvalue().strip()
     self.assertEquals(output, 'Invalid month range : 21')
コード例 #5
0
    def test__format_date_invalid_month_format(self):
        '''
        test _format_date with invalid month format
        '''

        ret = cleanup_clicrdv._format_date('2018/21/06')
        self.assertEquals(ret, None)
        output = sys.stdout.getvalue().strip()
        self.assertEquals(output, 'Invalid month format : /2')
コード例 #6
0
    def test__format_date_invalid_year_range(self):
        '''
        test _format_date with invalid year range
        '''

        ret = cleanup_clicrdv._format_date('10000621')
        self.assertEquals(ret, None)
        output = sys.stdout.getvalue().strip()
        self.assertEquals(output, 'Invalid year range : 1000')
コード例 #7
0
    def test__format_date_invalid_year_format(self):
        '''
        test _format_date with invalid year format
        '''

        ret = cleanup_clicrdv._format_date('18/06/21')
        self.assertEquals(ret, None)
        output = sys.stdout.getvalue().strip()
        self.assertEquals(output, 'Invalid year format : 18/0')