raise exception when TypeError occurs in cashdraw (#268)
This commit is contained in:
parent
d1e7052fa1
commit
3c3dab95f5
1
.mailmap
1
.mailmap
|
@ -10,3 +10,4 @@ Ahmed Tahri <nyuubi.10@gmail.com> TAHRI Ahmed <nyuubi.10@gmai
|
||||||
Michael Elsdörfer <michael@elsdoerfer.com> Michael Elsdörfer <michael@elsdoerfer.info>
|
Michael Elsdörfer <michael@elsdoerfer.com> Michael Elsdörfer <michael@elsdoerfer.info>
|
||||||
csoft2k <csoft2k@hotmail.com>
|
csoft2k <csoft2k@hotmail.com>
|
||||||
Sergio Pulgarin <sergio.pulgarin@gmail.com>
|
Sergio Pulgarin <sergio.pulgarin@gmail.com>
|
||||||
|
reck31 <rakesh.gunduka@gmail.com>
|
||||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -20,6 +20,7 @@ mrwunderbar666
|
||||||
Nathan Bookham
|
Nathan Bookham
|
||||||
Patrick Kanzler
|
Patrick Kanzler
|
||||||
Qian Linfeng
|
Qian Linfeng
|
||||||
|
reck31
|
||||||
Renato Lorenzi
|
Renato Lorenzi
|
||||||
Romain Porte
|
Romain Porte
|
||||||
Sam Cheng
|
Sam Cheng
|
||||||
|
|
|
@ -697,8 +697,8 @@ class Escpos(object):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self._raw(CD_KICK_DEC_SEQUENCE(*pin))
|
self._raw(CD_KICK_DEC_SEQUENCE(*pin))
|
||||||
except:
|
except TypeError as err:
|
||||||
raise CashDrawerError()
|
raise CashDrawerError(err)
|
||||||
|
|
||||||
def linedisplay_select(self, select_display=False):
|
def linedisplay_select(self, select_display=False):
|
||||||
""" Selects the line display or the printer
|
""" Selects the line display or the printer
|
||||||
|
|
|
@ -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])
|
||||||
|
|
Loading…
Reference in New Issue