Skip to content

Commit

Permalink
[#7] test numpy interface even with cv2
Browse files Browse the repository at this point in the history
  • Loading branch information
quicklizard99 committed Dec 1, 2016
1 parent 661e3eb commit 9f96b35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pyzbar/tests/test_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from pathlib import Path

import numpy as np

from PIL import Image

try:
Expand Down Expand Up @@ -83,6 +85,11 @@ def test_empty(self):
expected = []
self.assertEqual(expected, res)

def test_decode_numpy(self):
"Read image using Pillow and convert to numpy.ndarray"
res = decode(np.asarray(self.code128))
self.assertEqual(self.EXPECTED_CODE128, res)

@unittest.skipIf(cv2 is None, 'OpenCV not installed')
def test_decode_opencv(self):
"Read image using OpenCV"
Expand Down
1 change: 1 addition & 0 deletions requirements.pip
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ enum34==1.1.6; python_version == '2.7'
# TODO How to specify OpenCV? 'cv2>=2.4.8'
coveralls>=1.1
nose>=1.3.4
numpy>=1.8.2
pathlib>=1.0.1; python_version == '2.7'
Pillow>=3.2.0
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def readme():
},
'tests_require': [
# TODO How to specify OpenCV? 'cv2>=2.4.8',
PILLOW
PILLOW,
'numpy>=1.8.2',
],
'include_package_data': True,
'classifiers': [
Expand Down

0 comments on commit 9f96b35

Please sign in to comment.