Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def given_configurations(self, confs):
if 'TIMEZONE' not in confs:
confs.update({'TIMEZONE': 'local'})
self.confs = settings.replace(**confs)
def test_freshness_date_with_to_timezone_setting(self):
_settings = settings.replace(**{
'TIMEZONE': 'local',
'TO_TIMEZONE': 'UTC',
'RELATIVE_BASE': datetime(2014, 9, 1, 10, 30)
})
parser = dateparser.freshness_date_parser.FreshnessDateDataParser()
parser.get_local_tz = Mock(return_value=pytz.timezone('US/Eastern'))
result = parser.get_date_data('1 minute ago', _settings)
result = result['date_obj']
self.assertEqual(result.date(), date(2014, 9, 1))
self.assertEqual(result.time(), time(14, 29))