Пример #1
0
    def get_date_range(self):
        """Return the date range for the ingest as a (start, end) tuple.

        If either value is not defined in the config file or cannot be
        converted to a date it will be returned as None.
        """

        try:
            start_date = parse_date_from_string(self.datacube.start_date)
        except AttributeError:
            start_date = None

        try:
            end_date = parse_date_from_string(self.datacube.end_date)
        except AttributeError:
            end_date = None

        return (start_date, end_date)
Пример #2
0
    def get_date_range(self):
        """Return the date range for the ingest as a (start, end) tuple.

        If either value is not defined in the config file or cannot be
        converted to a date it will be returned as None.
        """

        try:
            start_date = parse_date_from_string(self.datacube.start_date)
        except AttributeError:
            start_date = None

        try:
            end_date = parse_date_from_string(self.datacube.end_date)
        except AttributeError:
            end_date = None

        return (start_date, end_date)
Пример #3
0
    def test_parse_date_bad_format(self):
        """Test of parsing date from string, bad format."""

        date = cube_util.parse_date_from_string('A Long Time Ago')
        self.assertEqual(date, None)
Пример #4
0
    def test_parse_date_format3(self):
        """Test of parsing date from string, format 3."""

        date = cube_util.parse_date_from_string('13/03/2014')
        self.assertEqual(date, datetime.date(2014, 3, 13))
Пример #5
0
    def test_parse_date_format2(self):
        """Test of parsing date from string, format 2."""

        date = cube_util.parse_date_from_string('2014-03-13')
        self.assertEqual(date, datetime.date(2014, 3, 13))
Пример #6
0
    def test_parse_date_bad_format(self):
        """Test of parsing date from string, bad format."""

        date = cube_util.parse_date_from_string('A Long Time Ago')
        self.assertEqual(date, None)
Пример #7
0
    def test_parse_date_format3(self):
        """Test of parsing date from string, format 3."""

        date = cube_util.parse_date_from_string('13/03/2014')
        self.assertEqual(date, datetime.date(2014, 3, 13))
Пример #8
0
    def test_parse_date_format2(self):
        """Test of parsing date from string, format 2."""

        date = cube_util.parse_date_from_string('2014-03-13')
        self.assertEqual(date, datetime.date(2014, 3, 13))