Ejemplo n.º 1
0
 def test__formatted(self):
     tests = [
         #(name, value, type, expect)
         ('_test__formatted_1', 'my string', 'string', 'my string'),
         ('_test__formatted_2', 'True',      'string', 'True'),
         ('_test__formatted_3', 'True',      'boolean', True),
         ('_test__formatted_4', 'False',     'boolean', False),
         ('_test__formatted_5', '',          'boolean', False),
         ('_test__formatted_6', '123',       'integer', 123),
         ]
     for t in tests:
         kwargs = dict(name=t[0], value=t[1], type=t[2])
         setting = Setting(DB.setting, **kwargs)
         self.assertEqual(setting.formatted_value(), t[3])