TST: Replace assertRaises with pytest.raises.

parent 6a28670b
......@@ -2,6 +2,7 @@ import os
import codecs
import tempfile
import pytest
import unittest
from pyocr import cuneiform
......@@ -73,11 +74,8 @@ class TestDigit(base.BaseTestDigit, BaseCuneiform, unittest.TestCase):
def test_digits_not_implemented(self):
image_path = self._path_to_img("test-digits.png")
self.assertRaises(
NotImplementedError,
self._read_from_img,
image_path
)
with pytest.raises(NotImplementedError):
self._read_from_img(image_path)
class TestWordBox(base.BaseTestWordBox, BaseCuneiform, unittest.TestCase):
......
......@@ -2,6 +2,7 @@ import codecs
import os
import tempfile
import pytest
import unittest
import PIL.Image
......@@ -96,7 +97,7 @@ class TestTxt(base.BaseTestText, BaseLibtesseract, unittest.TestCase):
tessdata_prefix = os.getenv("TESSDATA_PREFIX", "")
os.environ['TESSDATA_PREFIX'] = '/opt/tulipe'
try:
with self.assertRaises(PyocrException):
with pytest.raises(PyocrException):
self.tool.image_to_string(
PIL.Image.open(self._path_to_img('test-japanese.jpg')),
lang='fra'
......@@ -109,7 +110,7 @@ class TestTxt(base.BaseTestText, BaseLibtesseract, unittest.TestCase):
os.environ['TESSDATA_PREFIX'] = tessdata_prefix
def test_nolangs2(self):
with self.assertRaises(PyocrException):
with pytest.raises(PyocrException):
self.tool.image_to_string(
PIL.Image.open(self._path_to_img('test-japanese.jpg')),
lang='doesnotexist'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment