# Path: luma/core/device.py
# class dummy(device):
#     """
#     Pseudo-device that acts like a physical display, except that it does nothing
#     other than retain a copy of the displayed image. It is mostly useful for
#     testing. Supports 24-bit color depth.
#     """
# 
#     def __init__(self, width=128, height=64, rotate=0, mode="RGB", **kwargs):
#         super(dummy, self).__init__(serial_interface=noop())
#         self.capabilities(width, height, rotate, mode)
#         self.image = None
# 
#     def display(self, image):
#         """
#         Takes a :py:mod:`PIL.Image` and makes a copy of it for later
#         use/inspection.
# 
#         :param image: Image to display.
#         :type image: PIL.Image.Image
#         """
#         assert image.size == self.size
# 
#         self.image = self.preprocess(image).copy()


from unittest.mock import patch
from luma.core.device import dummy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Richard Hull and contributors
# See LICENSE.rst for details.





def test_persist():
    dev = dummy()
    assert dev.persist is False
    with patch.object(dev, 'hide') as mock:
        dev.cleanup()
    mock.assert_called_once_with()

# Path: luma/core/device.py
# class dummy(device):
#     """
#     Pseudo-device that acts like a physical display, except that it does nothing
#     other than retain a copy of the displayed image. It is mostly useful for
#     testing. Supports 24-bit color depth.
#     """
# 
#     def __init__(self, width=128, height=64, rotate=0, mode="RGB", **kwargs):
#         super(dummy, self).__init__(serial_interface=noop())
#         self.capabilities(width, height, rotate, mode)
#         self.image = None
# 
#     def display(self, image):
#         """
#         Takes a :py:mod:`PIL.Image` and makes a copy of it for later
#         use/inspection.
# 
#         :param image: Image to display.
#         :type image: PIL.Image.Image
#         """
#         assert image.size == self.size
# 
#         self.image = self.preprocess(image).copy()


# Path: tests/test_persist.py
from unittest.mock import patch
from luma.core.device import dummy

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Richard Hull and contributors
# See LICENSE.rst for details.





def test_persist():
    dev = dummy()
    assert dev.persist is False
    with patch.object(dev, 'hide') as mock:
        dev.cleanup()
    mock.assert_called_once_with()

    dev = dummy()