mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
remove nose dependencies
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from nose.tools import assert_raises
|
||||
from escpos.printer import Dummy
|
||||
|
||||
|
||||
|
@@ -8,7 +8,6 @@
|
||||
"""
|
||||
|
||||
|
||||
from nose.tools import raises
|
||||
import pytest
|
||||
|
||||
import escpos.printer as printer
|
||||
@@ -66,25 +65,25 @@ def test_model():
|
||||
assert instance.output == expected
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_ec():
|
||||
"""Test invalid QR error correction"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, ec=-1)
|
||||
with pytest.raises(ValueError):
|
||||
instance.qr("1234", native=True, ec=-1)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_size():
|
||||
"""Test invalid QR size"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, size=0)
|
||||
with pytest.raises(ValueError):
|
||||
instance.qr("1234", native=True, size=0)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_model():
|
||||
"""Test invalid QR model"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, model="Hello")
|
||||
with pytest.raises(ValueError):
|
||||
instance.qr("1234", native=True, model="Hello")
|
||||
|
||||
|
||||
@pytest.mark.skip("this test has to be debugged")
|
||||
@@ -103,11 +102,11 @@ def test_image():
|
||||
assert instance.output == expected
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_image_invalid_model():
|
||||
"""Test unsupported QR model as image"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=False, model=QR_MODEL_1)
|
||||
with pytest.raises(ValueError):
|
||||
instance.qr("1234", native=False, model=QR_MODEL_1)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@@ -1,4 +1,4 @@
|
||||
from nose.tools import assert_raises
|
||||
import pytest
|
||||
from escpos.printer import Dummy
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ def test_line_spacing_rest():
|
||||
|
||||
def test_line_spacing_error_handling():
|
||||
printer = Dummy()
|
||||
with assert_raises(ValueError):
|
||||
with pytest.raises(ValueError):
|
||||
printer.line_spacing(99, divisor=44)
|
||||
with assert_raises(ValueError):
|
||||
with pytest.raises(ValueError):
|
||||
printer.line_spacing(divisor=80, spacing=86)
|
||||
with assert_raises(ValueError):
|
||||
with pytest.raises(ValueError):
|
||||
printer.line_spacing(divisor=360, spacing=256)
|
||||
with assert_raises(ValueError):
|
||||
with pytest.raises(ValueError):
|
||||
printer.line_spacing(divisor=180, spacing=256)
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
|
||||
import pytest
|
||||
from nose.tools import raises, assert_raises
|
||||
from hypothesis import given, example
|
||||
import hypothesis.strategies as st
|
||||
from escpos.magicencode import MagicEncode, Encoder
|
||||
@@ -32,9 +31,9 @@ class TestEncoder:
|
||||
assert not Encoder({"CP437": 1}).find_suitable_encoding("€")
|
||||
assert Encoder({"CP858": 1}).find_suitable_encoding("€") == "CP858"
|
||||
|
||||
@raises(ValueError)
|
||||
def test_get_encoding(self):
|
||||
Encoder({}).get_encoding_name("latin1")
|
||||
with pytest.raises(ValueError):
|
||||
Encoder({}).get_encoding_name("latin1")
|
||||
|
||||
|
||||
class TestMagicEncode:
|
||||
|
Reference in New Issue
Block a user