

def test_struct_time(self):
    st = datetime.datetime(2010, 3, 12, 12, 34, 56).timetuple()
    raw_struct_time = filters.struct_time
    assert ('struct_time' in self.app.jinja_env.filters.keys())
    app_struct_time = self.app.jinja_env.filters['struct_time']
    self.assertEqual(raw_struct_time(st), '2010-03-12 12:34:56')
    self.assertEqual(app_struct_time(st), '2010-03-12 12:34:56')
    self.assertEqual(raw_struct_time(st, '%m/%d/%Y'), '03/12/2010')
    self.assertEqual(app_struct_time(st, '%m/%d/%Y'), '03/12/2010')
    self.app.config['DEFAULT_DATETIME_FORMAT'] = '%m/%d/%y'
    self.assertEqual(raw_struct_time(st), '03/12/10')
    self.assertEqual(app_struct_time(st), '03/12/10')
    self.assertEqual(raw_struct_time(st, None), '2010-03-12 12:34:56')
    self.assertEqual(app_struct_time(app_struct_time, None), '2010-03-12 12:34:56')
    self.assertEqual(raw_struct_time(st, format=None), '2010-03-12 12:34:56')
    self.assertEqual(app_struct_time(st, format=None), '2010-03-12 12:34:56')
    self.app.config['DEFAULT_DATETIME_FORMAT'] = None
    self.assertEqual(raw_struct_time(st), '2010-03-12 12:34:56')
    self.assertEqual(app_struct_time(st), '2010-03-12 12:34:56')

dataset/ETHPy150Open willowtreeapps/tango-core/tests/test_filters.py FiltersTestCase.test_struct_time/VarMisuse@176/325 `st`->`app_struct_time`