def setUp(self):
     self.processors = Processors()
     self.first_processor = Mock()
     self.second_processor = Mock()
     self.third_processor = Mock()
class ProcessorsTests(TestCase):

    def setUp(self):
        self.processors = Processors()
        self.first_processor = Mock()
        self.second_processor = Mock()
        self.third_processor = Mock()

    def test_register(self):
        self.processors.register('text/css', self.first_processor)
        self.processors.register('text/css', self.second_processor)
        self.processors.register('text/plain', self.third_processor)
        self.assertIn('text/css', self.processors)
        self.assertEqual(self.processors['text/css'], [self.first_processor, self.second_processor])
        self.assertIn('text/plain', self.processors)
        self.assertEqual(self.processors['text/plain'], [self.third_processor])

    def test_register_twice(self):
        self.processors.register('text/css', self.first_processor)
        self.processors.register('text/css', self.first_processor)
        self.assertEqual(self.processors['text/css'], [self.first_processor])

    def test_unregister(self):
        self.processors.register('text/css', self.first_processor)
        self.processors.register('text/css', self.second_processor)
        self.processors.unregister('text/css', self.first_processor)
        self.assertEqual(self.processors['text/css'], [self.second_processor])

    def test_unregister_if_does_not_exist(self):
        self.processors.unregister('text/css', self.first_processor)

    def test_get_if_exists(self):
        self.processors.register('text/css', self.first_processor)
        self.processors.register('text/css', self.second_processor)
        self.assertEqual(self.processors.get('text/css'), [self.first_processor, self.second_processor])

    def test_get_if_does_not_exist(self):
        self.assertEqual(self.processors.get('text/css'), [])