How to use the dateparser.conf.settings function in dateparser

To help you get started, we’ve selected a few dateparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scrapinghub / dateparser / tests / test_date.py View on Github external
def test_is_valid_date_obj(self, date_obj):
        self.given_parser(language=['en'], date_string='10 jan 2000',
                          date_formats=None, settings=settings)
        self.when_date_object_is_validated(date_obj)
        self.then_date_object_is_invalid()
github scrapinghub / dateparser / tests / test_hijri.py View on Github external
def test_datetime_parsing(self, dt_string, dt_obj,
                              date_formats=None, languages=None):
        from dateparser.conf import settings
        settings.DATE_ORDER = 'DMY'
        self.when_date_is_given(dt_string, date_formats, languages)
        self.then_parsed_datetime_is(dt_obj)
        settings.DATE_ORDER = 'MDY'
github scrapinghub / dateparser / tests / test_hijri.py View on Github external
def test_datetime_parsing(self, dt_string, dt_obj,
                              date_formats=None, languages=None):
        from dateparser.conf import settings
        settings.DATE_ORDER = 'DMY'
        self.when_date_is_given(dt_string, date_formats, languages)
        self.then_parsed_datetime_is(dt_obj)
        settings.DATE_ORDER = 'MDY'
github scrapinghub / dateparser / tests / test_settings.py View on Github external
def setUp(self):
        super(SettingsTest, self).setUp()
        self.default_settings = settings
github scrapinghub / dateparser / dateparser / calendars / __init__.py View on Github external
def get_date(self):
        try:
            date_obj, period = self.parser.parse(self.source, settings)
            return {'date_obj': date_obj, 'period': period}
        except ValueError:
            pass