2016-03-02 22:16:58 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
"""tests for the text printing function
|
|
|
|
|
|
|
|
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
|
|
|
|
:organization: `python-escpos <https://github.com/python-escpos>`_
|
|
|
|
:copyright: Copyright (c) 2016 `python-escpos <https://github.com/python-escpos>`_
|
|
|
|
:license: GNU GPL v3
|
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-07-23 20:16:11 +00:00
|
|
|
import mock
|
|
|
|
from hypothesis import given
|
|
|
|
import hypothesis.strategies as st
|
2016-03-02 22:16:58 +00:00
|
|
|
|
|
|
|
import escpos.printer as printer
|
|
|
|
|
2016-07-23 20:16:11 +00:00
|
|
|
@given(text=st.text())
|
|
|
|
def test_function_text_dies_ist_ein_test_lf(text):
|
2016-03-02 22:16:58 +00:00
|
|
|
"""test the text printing function with simple string and compare output"""
|
2016-07-23 20:16:11 +00:00
|
|
|
instance = printer.Dummy()
|
|
|
|
instance.magic.encode_text = mock.Mock()
|
|
|
|
instance.text(text)
|
|
|
|
instance.magic.encode_text.assert_called_with(txt=text)
|