From d6d12f99d4ad19eb136abe0ebdf716039c77d5c3 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Sun, 8 Oct 2017 21:27:23 +0200 Subject: [PATCH] improve test - tests raising of error #257 --- test/test_raise_arbitrary_error.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/test_raise_arbitrary_error.py b/test/test_raise_arbitrary_error.py index cbcae19..edf8fb0 100644 --- a/test/test_raise_arbitrary_error.py +++ b/test/test_raise_arbitrary_error.py @@ -12,12 +12,21 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals +import pytest import escpos +import escpos.exceptions -def test_raise_error(): - """raise error +def test_raise_error_wrongly(): + """raise error the wrong way should reproduce https://github.com/python-escpos/python-escpos/issues/257 """ - raise escpos.Error("This is a test.") + with pytest.raises(AttributeError): + raise escpos.Error("This should raise an AttributeError.") + + +def tests_raise_error(): + """raise error the right way""" + with pytest.raises(escpos.exceptions.Error): + raise escpos.exceptions.Error("This should raise an error.")