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_use_utc(self, h):
assert humanize.time._now == datetime.utcnow
humanize.init_app(app)
"""
for k, v in default_config.items():
app.config.setdefault(self_name(k), v)
if app_has_babel(app):
default_locale = app.config['BABEL_DEFAULT_LOCALE']
if default_locale is not None:
app.config.setdefault(self_name('default_locale'), default_locale)
if app.config.get('HUMANIZE_USE_UTC'):
# Override humanize.time._now to use UTC time
humanize.time._now = datetime.utcnow
else:
humanize.time._now = datetime.now
app.add_template_filter(self._humanize, 'humanize')
app.before_request(self._set_locale)
app.after_request(self._unset_locale)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['humanize'] = self
app = create_app()
humanize.init_app(app)
"""
for k, v in default_config.items():
app.config.setdefault(self_name(k), v)
if app_has_babel(app):
default_locale = app.config['BABEL_DEFAULT_LOCALE']
if default_locale is not None:
app.config.setdefault(self_name('default_locale'), default_locale)
if app.config.get('HUMANIZE_USE_UTC'):
# Override humanize.time._now to use UTC time
humanize.time._now = datetime.utcnow
else:
humanize.time._now = datetime.now
app.add_template_filter(self._humanize, 'humanize')
app.before_request(self._set_locale)
app.after_request(self._unset_locale)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['humanize'] = self