Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
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'
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'
def setUp(self):
super(SettingsTest, self).setUp()
self.default_settings = settings
def get_date(self):
try:
date_obj, period = self.parser.parse(self.source, settings)
return {'date_obj': date_obj, 'period': period}
except ValueError:
pass