# Path: ebu_tt_live/carriage/interface.py
# class ICarriageMechanism(object):
# class IProducerCarriage(ICarriageMechanism):
# class IConsumerCarriage(ICarriageMechanism):
#     def expects(cls):
#     def register_producer_node(self, node):
#     def producer_node(self):
#     def emit_data(self, data, **kwargs):
#     def resume_producing(self):
#     def provides(cls):
#     def register_consumer_node(self, node):
#     def consumer_node(self):
#     def on_new_data(self, data, **kwargs):
# 
# Path: ebu_tt_live/carriage/base.py
# class AbstractCarriage(object):
# class AbstractProducerCarriage(IProducerCarriage, AbstractCarriage):
# class AbstractConsumerCarriage(IConsumerCarriage, AbstractCarriage):
# class AbstractCombinedCarriage(AbstractConsumerCarriage, AbstractProducerCarriage):
#     def is_document(self, document):
#     def register_producer_node(self, node):
#     def producer_node(self):
#     def resume_producing(self):
#     def register_consumer_node(self, node):
#     def consumer_node(self):
# 
# Path: ebu_tt_live/node/interface.py
# class INode(object):
# class IProducerNode(INode):
# class IConsumerNode(INode):
#     def process_document(self, document, **kwargs):
#     def resume_producing(self):
#     def provides(cls):
#     def producer_carriage(self):
#     def register_producer_carriage(self, producer_carriage):
#     def expects(cls):
#     def consumer_carriage(self):
#     def register_consumer_carriage(self, consumer_carriage):
# 
# Path: ebu_tt_live/errors.py
# class ComponentCompatError(TypeError):
#     pass
# 
# class DataCompatError(TypeError):
#     pass


from unittest import TestCase
from ebu_tt_live.carriage import interface as carriage_interface
from ebu_tt_live.carriage import base as carriage_base
from ebu_tt_live.node import interface as node_interface
from ebu_tt_live.errors import ComponentCompatError, DataCompatError
from mock import MagicMock

    def test_abstract_classes(self):
        self.assertRaises(TypeError, carriage_base.AbstractProducerCarriage)
        self.assertRaises(TypeError, carriage_base.AbstractConsumerCarriage)
        self.assertRaises(TypeError, carriage_base.AbstractCombinedCarriage)


class TestDummyCarriages(TestCase):

    def setUp(self):
        prod_node = MagicMock(spec=node_interface.IProducerNode)
        prod_node.provides.return_value = DummyDataTypeA
        self._producer_node = prod_node

        cons_node = MagicMock(spec=node_interface.IConsumerNode)
        cons_node.expects.return_value = DummyDataTypeA
        self._consumer_node = cons_node

        # We can't unittest with combined mocked out because MagicMock can't emulate 2 interfaces
        # comb_node = MagicMock(spec=[node_interface.IProducerNode, node_interface.IConsumerNode])
        # comb_node.provides.return_value = DummyDataTypeA
        # comb_node.expects.return_value = DummyDataTypeA
        # self._combined_node = comb_node

    def _get_dummy_producer_carriage(self, expects):
        class DummyProducerCarriage(carriage_base.AbstractProducerCarriage):

            _expects = expects

            def emit_data(self, data, **kwargs):

# Path: ebu_tt_live/carriage/interface.py
# class ICarriageMechanism(object):
# class IProducerCarriage(ICarriageMechanism):
# class IConsumerCarriage(ICarriageMechanism):
#     def expects(cls):
#     def register_producer_node(self, node):
#     def producer_node(self):
#     def emit_data(self, data, **kwargs):
#     def resume_producing(self):
#     def provides(cls):
#     def register_consumer_node(self, node):
#     def consumer_node(self):
#     def on_new_data(self, data, **kwargs):
# 
# Path: ebu_tt_live/carriage/base.py
# class AbstractCarriage(object):
# class AbstractProducerCarriage(IProducerCarriage, AbstractCarriage):
# class AbstractConsumerCarriage(IConsumerCarriage, AbstractCarriage):
# class AbstractCombinedCarriage(AbstractConsumerCarriage, AbstractProducerCarriage):
#     def is_document(self, document):
#     def register_producer_node(self, node):
#     def producer_node(self):
#     def resume_producing(self):
#     def register_consumer_node(self, node):
#     def consumer_node(self):
# 
# Path: ebu_tt_live/node/interface.py
# class INode(object):
# class IProducerNode(INode):
# class IConsumerNode(INode):
#     def process_document(self, document, **kwargs):
#     def resume_producing(self):
#     def provides(cls):
#     def producer_carriage(self):
#     def register_producer_carriage(self, producer_carriage):
#     def expects(cls):
#     def consumer_carriage(self):
#     def register_consumer_carriage(self, consumer_carriage):
# 
# Path: ebu_tt_live/errors.py
# class ComponentCompatError(TypeError):
#     pass
# 
# class DataCompatError(TypeError):
#     pass


# Path: ebu_tt_live/carriage/test/test_base_carriage.py
from unittest import TestCase
from ebu_tt_live.carriage import interface as carriage_interface
from ebu_tt_live.carriage import base as carriage_base
from ebu_tt_live.node import interface as node_interface
from ebu_tt_live.errors import ComponentCompatError, DataCompatError
from mock import MagicMock


    def test_abstract_classes(self):
        self.assertRaises(TypeError, carriage_base.AbstractProducerCarriage)
        self.assertRaises(TypeError, carriage_base.AbstractConsumerCarriage)
        self.assertRaises(TypeError, carriage_base.AbstractCombinedCarriage)


class TestDummyCarriages(TestCase):

    def setUp(self):
        prod_node = MagicMock(spec=node_interface.IProducerNode)
        prod_node.provides.return_value = DummyDataTypeA
        self._producer_node = prod_node

        cons_node = MagicMock(spec=node_interface.IConsumerNode)
        cons_node.expects.return_value = DummyDataTypeA
        self._consumer_node = cons_node

        # We can't unittest with combined mocked out because MagicMock can't emulate 2 interfaces
        # comb_node = MagicMock(spec=[node_interface.IProducerNode, node_interface.IConsumerNode])
        # comb_node.provides.return_value = DummyDataTypeA
        # comb_node.expects.return_value = DummyDataTypeA
        # self._combined_node = comb_node

    def _get_dummy_producer_carriage(self, expects):
        class DummyProducerCarriage(carriage_base.AbstractProducerCarriage):

            _expects = expects

            def emit_data(self, data, **kwargs):

                pass