def test_cannot_unregister_a_non_registered_placeholder(self):
     # Setup
     number_of_placeholders_before = len(placeholder_pool.get_placeholders())
     # Run & check
     with pytest.raises(PlaceholderNotRegistered):
         placeholder_pool.unregister_placeholder(FooPlaceholder)
     number_of_placeholders_after = len(placeholder_pool.get_placeholders())
     assert number_of_placeholders_before == number_of_placeholders_after
 def test_cannot_unregister_a_non_registered_placeholder(self):
     # Setup
     number_of_placeholders_before = len(placeholder_pool.get_placeholders())
     # Run & check
     with self.assertRaises(PlaceholderNotRegistered):
         placeholder_pool.unregister_placeholder(FooPlaceholder)
     number_of_placeholders_after = len(placeholder_pool.get_placeholders())
     self.assertEqual(number_of_placeholders_before, number_of_placeholders_after)
 def test_cannot_register_placeholders_with_incorrect_parent_classes(self):
     # Setup
     number_of_placeholders_before = len(placeholder_pool.get_placeholders())
     # Run & check
     with pytest.raises(ImproperlyConfigured):
         class ErrnoneousPlaceholder:
             pass
         placeholder_pool.register_placeholder(ErrnoneousPlaceholder)
     number_of_placeholders_after = len(placeholder_pool.get_placeholders())
     assert number_of_placeholders_before == number_of_placeholders_after
 def test_should_raise_if_a_placeholder_is_registered_twice(self):
     # Setup
     number_of_placeholders_before = len(placeholder_pool.get_placeholders())
     placeholder_pool.register_placeholder(FooPlaceholder)
     # Run & check
     # Let's add it a second time. We should catch an exception
     with pytest.raises(PlaceholderAlreadyRegistered):
         placeholder_pool.register_placeholder(FooPlaceholder)
     # Let's make sure we have the same number of tags as before
     placeholder_pool.unregister_placeholder(FooPlaceholder)
     number_of_placeholders_after = len(placeholder_pool.get_placeholders())
     assert number_of_placeholders_before == number_of_placeholders_after
 def init_bbcode_placeholders(self):
     """
     Call the BBCode placeholder pool to fetch all the module-based placeholders
     and initializes them.
     """
     from precise_bbcode.placeholder_pool import placeholder_pool
     placeholders = placeholder_pool.get_placeholders()
     for placeholder in placeholders:
         self.parser.add_placeholder(placeholder)
 def init_bbcode_placeholders(self):
     """
     Call the BBCode placeholder pool to fetch all the module-based placeholders
     and initializes them.
     """
     from precise_bbcode.placeholder_pool import placeholder_pool
     placeholders = placeholder_pool.get_placeholders()
     for placeholder in placeholders:
         self.parser.add_placeholder(placeholder)