Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Ahmed Tahri <[email protected]> TAHRI Ahmed <nyuubi.10@gmai
Michael Elsdörfer <[email protected]> Michael Elsdörfer <[email protected]>
csoft2k <[email protected]>
Sergio Pulgarin <[email protected]>
reck31 <[email protected]>
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mrwunderbar666
Nathan Bookham
Patrick Kanzler
Qian Linfeng
reck31
Renato Lorenzi
Romain Porte
Sam Cheng
Expand Down
4 changes: 2 additions & 2 deletions src/escpos/escpos.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ def cashdraw(self, pin):
else:
try:
self._raw(CD_KICK_DEC_SEQUENCE(*pin))
except:
raise CashDrawerError()
except TypeError as err:
raise CashDrawerError(err)

def linedisplay_select(self, select_display=False):
""" Selects the line display or the printer
Expand Down
19 changes: 19 additions & 0 deletions test/test_function_cashdraw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import escpos.printer as printer
from escpos.exceptions import CashDrawerError
import pytest


def test_raise_CashDrawerError():
"""should raise an error if the sequence is invalid.
"""
instance = printer.Dummy()
with pytest.raises(CashDrawerError):
# call with sequence that is too long
instance.cashdraw([1,1,1,1,1,1])