# Path: mcm/adapters.py
# class MasterAdapter:
# 
# 
#     def __init__(self, device):
#         self.device = device
# 
# 
#     def read(self, path):
#         content = self.device.read(path=path.absolute)
#         data = self.assemble_data(data=content)
#         for row in data:
#             logger.debug('{path} {data}'.format(path=path.absolute, data=row))
#         return data
# 
# 
#     def close(self):
#         self.device.close()
# 
# 
#     @staticmethod
#     def assemble_data(data):
#         return tuple(CmdPathRow(elem) for elem in data)
# 
# class SlaveAdapter(MasterAdapter):
# 
# 
#     def write(self, path, action, data):
#         for row in data:
#             try:
#                 self.device.write(path=path.absolute, action=action, data=row)
#                 logger.info('{path} {action} {data}'.format(path=path.absolute, action=action, data=row))
#             except WriteError as error:
#                 logger.error('Failed to send {path} {action} {data} to device: {reason}'.format(path=path.absolute, action=action, data=row, reason=error))
# 
# Path: mcm/exceptions.py
# class WriteError(Exception):
#     '''
#     Exception raised when writing to master or slave occured.
#     '''


from mock import MagicMock, patch
from mcm.adapters import MasterAdapter, SlaveAdapter
from mcm.exceptions import WriteError
import pytest
# -*- coding: UTF-8 -*-




@pytest.fixture
def master_adapter():
    return MasterAdapter(device=MagicMock())



# Path: mcm/adapters.py
# class MasterAdapter:
# 
# 
#     def __init__(self, device):
#         self.device = device
# 
# 
#     def read(self, path):
#         content = self.device.read(path=path.absolute)
#         data = self.assemble_data(data=content)
#         for row in data:
#             logger.debug('{path} {data}'.format(path=path.absolute, data=row))
#         return data
# 
# 
#     def close(self):
#         self.device.close()
# 
# 
#     @staticmethod
#     def assemble_data(data):
#         return tuple(CmdPathRow(elem) for elem in data)
# 
# class SlaveAdapter(MasterAdapter):
# 
# 
#     def write(self, path, action, data):
#         for row in data:
#             try:
#                 self.device.write(path=path.absolute, action=action, data=row)
#                 logger.info('{path} {action} {data}'.format(path=path.absolute, action=action, data=row))
#             except WriteError as error:
#                 logger.error('Failed to send {path} {action} {data} to device: {reason}'.format(path=path.absolute, action=action, data=row, reason=error))
# 
# Path: mcm/exceptions.py
# class WriteError(Exception):
#     '''
#     Exception raised when writing to master or slave occured.
#     '''


# Path: tests/test_adapters.py
from mock import MagicMock, patch
from mcm.adapters import MasterAdapter, SlaveAdapter
from mcm.exceptions import WriteError
import pytest

# -*- coding: UTF-8 -*-




@pytest.fixture
def master_adapter():
    return MasterAdapter(device=MagicMock())



@pytest.fixture