Exemple #1
0
    def test_parse_date_none(self):
        """
        Xpath will return none if the element is not found.
        :return:
        """
        def bogus():
            return None

        self.assertIsNone(parse_date(bogus)())
Exemple #2
0
    def test_parse_valid_date(self):
        def bogus():
            return '2001-01-01T06:00:00+00:00'

        self.assertEqual(
            parse_date(bogus)(), datetime.datetime(2001, 1, 1, 1, 0, 0))
Exemple #3
0
    def test_parse_invalid_date(self):
        def bogus():
            return 'this-date-is-invalid'

        self.assertIsNone(parse_date(bogus)())