def test_extend_same_name_doesnt_conflict(self): config = self.config config.add_directive('dummy_extend', dummy_extend) config.add_directive('dummy_extend', dummy_extend2) self.assertTrue(hasattr(config, 'dummy_extend')) config.dummy_extend('discrim') after = config.action_state action = after.actions[-1] self.assertEqual(action['discriminator'], 'discrim') self.assertEqual(action['callable'], None) self.assertEqual(action['args'], config.registry)
def test_extend_with_python_callable(self): from tests import test_config config = self.config config.add_directive('dummy_extend', dummy_extend) self.assertTrue(hasattr(config, 'dummy_extend')) config.dummy_extend('discrim') after = config.action_state action = after.actions[-1] self.assertEqual(action['discriminator'], 'discrim') self.assertEqual(action['callable'], None) self.assertEqual(action['args'], test_config)
def test_extend_action_method_successful(self): config = self.config config.add_directive('dummy_extend', dummy_extend) config.dummy_extend('discrim') config.dummy_extend('discrim') self.assertRaises(ConfigurationConflictError, config.commit)