meta_tests.py 738 B

123456789101112131415161718192021222324
  1. """Cement meta tests."""
  2. from cement.core import backend, exc, meta
  3. from cement.utils import test
  4. class TestMeta(meta.MetaMixin):
  5. class Meta:
  6. option_one = 'value one'
  7. option_two = 'value two'
  8. def __init__(self, **kw):
  9. super(TestMeta, self).__init__(**kw)
  10. self.option_three = kw.get('option_three', None)
  11. class MetaTestCase(test.CementCoreTestCase):
  12. def test_passed_kwargs(self):
  13. t = TestMeta(option_two='some other value', option_three='value three')
  14. self.eq(t._meta.option_one, 'value one')
  15. self.eq(t._meta.option_two, 'some other value')
  16. self.eq(hasattr(t._meta, 'option_three'), False)
  17. self.eq(t.option_three, 'value three')