Bump to version 0.20.1

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
epel9
Mauro Carvalho Chehab 7 years ago
parent 76f84ecfb5
commit 3353f69d9d

1
.gitignore vendored

@ -1,3 +1,4 @@
zbar-0.10.tar.bz2
/zbar-0.10.tar.bz2
/zbar-0.20.tar.bz2
/zbar-0.20.1.tar.bz2

@ -1 +1 @@
SHA512 (zbar-0.20.tar.bz2) = a371a655c961e3aa6abb1f5a5c6a43987619a2a4d43e4011c7979c42d94287600dcd5babb5258cfa134fc90905d3fb3c0216b0b38e05de729db13fbf522af886
SHA512 (zbar-0.20.1.tar.bz2) = 3b0949fe866eb9cb7a6ab66bfbc5ff2fc4193faf21a51c830d16e63453dcbd6e786e197fd5db40d62749af2487922e1775af860918717b0d51765d2b20dfd3f8

@ -2,17 +2,15 @@
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: zbar
Version: 0.20
Release: 8%{?dist}
Version: 0.20.1
Release: 1%{?dist}
Summary: Bar code reader
Group: User Interface/X Hardware Support
License: LGPLv2+
URL: http://zbar.sourceforge.net/
Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2
Patch0: zbar_set_python_via_env.patch
Patch1: zbar_prefer_pygobject2_codegen.patch
Patch2: zbar_fedora29_hack_for_codegen_to_work.patch
Patch0: zbar_fedora29_hack_for_codegen_to_work.patch
BuildRequires: autoconf automake libtool gettext-devel
BuildRequires: qt5-qtbase-devel qt5-qtx11extras-devel
@ -91,8 +89,6 @@ scanning widget.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
autoreconf -vfi
@ -180,7 +176,10 @@ rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/
%{_includedir}/zbar/QZBar*.h
%changelog
* Tue Aug 07 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20.8
* Wed Aug 08 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20.1-1
- Bump version to 0.20.1
* Tue Aug 07 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20-8
- Fix python 2 dependencies
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20-7

@ -1,13 +1,3 @@
diff --git a/examples/upcrpc.py b/examples/upcrpc.py
index 2e2a66867c8c..bc0bc8b884c6 100755
--- a/examples/upcrpc.py
+++ b/examples/upcrpc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from xmlrpclib import ServerProxy
import sys, re
diff --git a/pygtk/Makefile.am.inc b/pygtk/Makefile.am.inc
index 433412c8bcb5..33c65ad8975b 100644
--- a/pygtk/Makefile.am.inc
@ -22,73 +12,3 @@ index 433412c8bcb5..33c65ad8975b 100644
+ ./codegen.sh --prefix zbarpygtk \
--register $(PYGTK_DEFS)/gdk-types.defs \
--override $(srcdir)/pygtk/zbarpygtk.override $< > $@
diff --git a/python/examples/processor.py b/python/examples/processor.py
index b8f20f053dc6..e0ae92d30ceb 100644
--- a/python/examples/processor.py
+++ b/python/examples/processor.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from sys import argv
import zbar
diff --git a/python/examples/read_one.py b/python/examples/read_one.py
index 7a18c9998c0f..3b881e5d133f 100644
--- a/python/examples/read_one.py
+++ b/python/examples/read_one.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from sys import argv
import zbar
diff --git a/python/examples/scan_image.py b/python/examples/scan_image.py
index e26cb427064b..8b8bce0323d4 100644
--- a/python/examples/scan_image.py
+++ b/python/examples/scan_image.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from sys import argv
import zbar
from PIL import Image
diff --git a/python/setup.py b/python/setup.py
index f7639c57bd9d..585baf0be43e 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
from distutils.core import setup, Extension
setup(
diff --git a/python/test/test_zbar.py b/python/test/test_zbar.py
index 5b63de47adb3..b5aad03ca51b 100755
--- a/python/test/test_zbar.py
+++ b/python/test/test_zbar.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, os, re
import unittest as ut
import zbar
diff --git a/test/barcodetest.py b/test/barcodetest.py
index e271f0681116..488df70db7c6 100755
--- a/test/barcodetest.py
+++ b/test/barcodetest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, re, unittest as UT, xml.etree.ElementTree as ET
from os import path, getcwd
diff --git a/test/test_pygtk.py b/test/test_pygtk.py
index 902b8ff62266..ab413894e086 100755
--- a/test/test_pygtk.py
+++ b/test/test_pygtk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
#------------------------------------------------------------------------
# Copyright 2008-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
#

@ -1,25 +0,0 @@
commit 4e88270fdf42bd6dcbfeb4130bc9b4edc850211f
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date: Tue Aug 7 16:51:23 2018 -0300
configure.ac: prefer using pygobject-codegen-2.0
Get rid of this warning:
note: pygtk-codegen-2.0 is deprecated, use pygobject-codegen-2.0 instead
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
diff --git a/configure.ac b/configure.ac
index 141a3c2ab9f3..67148815097a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,7 +465,8 @@ Install the development package for python-$am_cv_python_version, or configure
AS_IF([test "x$with_gtk" = "xyes"],
[PKG_CHECK_MODULES([PYGTK], [pygtk-2.0])
- AC_CHECK_PROGS([PYGTK_CODEGEN], [pygtk-codegen-2.0 pygtk-codegen], [:])
+ AC_CHECK_PROGS([PYGTK_CODEGEN], [pygobject-codegen-2.0 pygtk-codegen-2.0 pygtk-codegen], [:])
+
AS_IF([test "x$PYGTK_H2DEF" = "x"],
[PYGTK_H2DEF=`$PKG_CONFIG pygtk-2.0 --variable=codegendir`/h2def.py
AS_IF([test -f "$PYGTK_H2DEF"], [], [PYGTK_H2DEF=":"])])

@ -1,505 +0,0 @@
commit c06e7e1940fd089749cebb0d3082ff5fae57c10b
Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Date: Tue Aug 7 15:02:11 2018 -0300
python: Make it work with modern versions of python 2
Some of the examples and test code don't work with python 2.7
and PIL. Modernize them by running 2to3 and fixing PIL manually.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
diff --git a/configure.ac b/configure.ac
index 141a3c2ab9f3..c808dab7e7bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -444,7 +444,7 @@ AC_ARG_VAR([PYGTK_CODEGEN], [full path to pygtk-codegen program])
AC_ARG_VAR([PYGTK_DEFS], [directory where PyGTK definitions may be found])
AS_IF([test "x$with_python" != "xno"],
- [AM_PATH_PYTHON(2.3.5)
+ [AM_PATH_PYTHON(2.7.0)
AS_IF([test "x$PYTHON_CFLAGS" != "x"],
[],
[test "x$PYTHON_CONFIG" != "x" && test -x "$PYTHON_CONFIG"],
diff --git a/python/examples/processor.py b/python/examples/processor.py
index 52996d16cf0d..b8f20f053dc6 100644
--- a/python/examples/processor.py
+++ b/python/examples/processor.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
from sys import argv
import zbar
@@ -19,7 +19,7 @@ def my_handler(proc, image, closure):
# extract results
for symbol in image.symbols:
# do something useful with results
- print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+ print('decoded', symbol.type, 'symbol', '"%s"' % symbol.data)
proc.set_data_handler(my_handler)
@@ -31,5 +31,5 @@ proc.active = True
try:
# keep scanning until user provides key/mouse input
proc.user_wait()
-except zbar.WindowClosed, e:
+except zbar.WindowClosed as e:
pass
diff --git a/python/examples/read_one.py b/python/examples/read_one.py
index 426b9994155e..7a18c9998c0f 100644
--- a/python/examples/read_one.py
+++ b/python/examples/read_one.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
from sys import argv
import zbar
@@ -26,4 +26,4 @@ proc.visible = False
# extract results
for symbol in proc.results:
# do something useful with results
- print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+ print('decoded', symbol.type, 'symbol', '"%s"' % symbol.data)
diff --git a/python/examples/scan_image.py b/python/examples/scan_image.py
index 2a80759da7b5..e26cb427064b 100644
--- a/python/examples/scan_image.py
+++ b/python/examples/scan_image.py
@@ -1,7 +1,7 @@
-#!/usr/bin/python
+#!/usr/bin/env python
from sys import argv
import zbar
-import Image
+from PIL import Image
if len(argv) < 2: exit(1)
@@ -14,7 +14,7 @@ scanner.parse_config('enable')
# obtain image data
pil = Image.open(argv[1]).convert('L')
width, height = pil.size
-raw = pil.tostring()
+raw = pil.tobytes()
# wrap image data
image = zbar.Image(width, height, 'Y800', raw)
@@ -25,7 +25,7 @@ scanner.scan(image)
# extract results
for symbol in image:
# do something useful with results
- print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+ print('decoded', symbol.type, 'symbol', '"%s"' % symbol.data)
# clean up
del(image)
diff --git a/python/test/test_zbar.py b/python/test/test_zbar.py
index dbe180324378..5b63de47adb3 100755
--- a/python/test/test_zbar.py
+++ b/python/test/test_zbar.py
@@ -1,18 +1,18 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys, os, re
import unittest as ut
import zbar
# FIXME this needs to be conditional
# would be even better to auto-select PIL or ImageMagick (or...)
-import Image
+from PIL import Image
data = None
size = (0, 0)
def load_image():
image = Image.open(os.path.join(sys.path[0], "barcode.png")).convert('L')
- return(image.tostring(), image.size)
+ return(image.tobytes(), image.size)
# FIXME this could be integrated w/fixture creation
(data, size) = load_image()
@@ -32,17 +32,17 @@ is_identifier = re.compile(r'^[A-Z][A-Z_0-9]*$')
class TestZBarFunctions(ut.TestCase):
def test_version(self):
ver = zbar.version()
- self.assert_(isinstance(ver, tuple))
+ self.assertTrue(isinstance(ver, tuple))
self.assertEqual(len(ver), 2)
for v in ver:
- self.assert_(isinstance(v, int))
+ self.assertTrue(isinstance(v, int))
def test_verbosity(self):
zbar.increase_verbosity()
zbar.set_verbosity(16)
def test_exceptions(self):
- self.assert_(isinstance(zbar.Exception, type))
+ self.assertTrue(isinstance(zbar.Exception, type))
for err in (zbar.InternalError,
zbar.UnsupportedError,
zbar.InvalidRequestError,
@@ -53,7 +53,7 @@ class TestZBarFunctions(ut.TestCase):
zbar.X11ProtocolError,
zbar.WindowClosed,
zbar.WinAPIError):
- self.assert_(issubclass(err, zbar.Exception))
+ self.assertTrue(issubclass(err, zbar.Exception))
def test_configs(self):
for cfg in (zbar.Config.ENABLE,
@@ -66,16 +66,16 @@ class TestZBarFunctions(ut.TestCase):
zbar.Config.POSITION,
zbar.Config.X_DENSITY,
zbar.Config.Y_DENSITY):
- self.assert_(isinstance(cfg, zbar.EnumItem))
- self.assert_(int(cfg) >= 0)
- self.assert_(is_identifier.match(str(cfg)))
+ self.assertTrue(isinstance(cfg, zbar.EnumItem))
+ self.assertTrue(int(cfg) >= 0)
+ self.assertTrue(is_identifier.match(str(cfg)))
def test_modifiers(self):
for mod in (zbar.Modifier.GS1,
zbar.Modifier.AIM):
- self.assert_(isinstance(mod, zbar.EnumItem))
- self.assert_(int(mod) >= 0)
- self.assert_(is_identifier.match(str(mod)))
+ self.assertTrue(isinstance(mod, zbar.EnumItem))
+ self.assertTrue(int(mod) >= 0)
+ self.assertTrue(is_identifier.match(str(mod)))
def test_symbologies(self):
for sym in (zbar.Symbol.NONE,
@@ -95,9 +95,9 @@ class TestZBarFunctions(ut.TestCase):
zbar.Symbol.QRCODE,
zbar.Symbol.CODE93,
zbar.Symbol.CODE128):
- self.assert_(isinstance(sym, zbar.EnumItem))
- self.assert_(int(sym) >= 0)
- self.assert_(is_identifier.match(str(sym)))
+ self.assertTrue(isinstance(sym, zbar.EnumItem))
+ self.assertTrue(int(sym) >= 0)
+ self.assertTrue(is_identifier.match(str(sym)))
def test_orientations(self):
for orient in (zbar.Orient.UNKNOWN,
@@ -105,9 +105,9 @@ class TestZBarFunctions(ut.TestCase):
zbar.Orient.RIGHT,
zbar.Orient.DOWN,
zbar.Orient.LEFT):
- self.assert_(isinstance(orient, zbar.EnumItem))
- self.assert_(-1 <= int(orient) <= 3)
- self.assert_(is_identifier.match(str(orient)))
+ self.assertTrue(isinstance(orient, zbar.EnumItem))
+ self.assertTrue(-1 <= int(orient) <= 3)
+ self.assertTrue(is_identifier.match(str(orient)))
class TestScanner(ut.TestCase):
def setUp(self):
@@ -117,10 +117,10 @@ class TestScanner(ut.TestCase):
del(self.scn)
def test_type(self):
- self.assert_(isinstance(self.scn, zbar.Scanner))
- self.assert_(callable(self.scn.reset))
- self.assert_(callable(self.scn.new_scan))
- self.assert_(callable(self.scn.scan_y))
+ self.assertTrue(isinstance(self.scn, zbar.Scanner))
+ self.assertTrue(callable(self.scn.reset))
+ self.assertTrue(callable(self.scn.new_scan))
+ self.assertTrue(callable(self.scn.scan_y))
def set_color(color):
self.scn.color = color
@@ -140,13 +140,13 @@ class TestDecoder(ut.TestCase):
del(self.dcode)
def test_type(self):
- self.assert_(isinstance(self.dcode, zbar.Decoder))
- self.assert_(callable(self.dcode.set_config))
- self.assert_(callable(self.dcode.parse_config))
- self.assert_(callable(self.dcode.reset))
- self.assert_(callable(self.dcode.new_scan))
- self.assert_(callable(self.dcode.set_handler))
- self.assert_(callable(self.dcode.decode_width))
+ self.assertTrue(isinstance(self.dcode, zbar.Decoder))
+ self.assertTrue(callable(self.dcode.set_config))
+ self.assertTrue(callable(self.dcode.parse_config))
+ self.assertTrue(callable(self.dcode.reset))
+ self.assertTrue(callable(self.dcode.new_scan))
+ self.assertTrue(callable(self.dcode.set_handler))
+ self.assertTrue(callable(self.dcode.decode_width))
def set_type(typ):
self.dcode.type = typ
@@ -165,25 +165,25 @@ class TestDecoder(ut.TestCase):
def test_width(self):
sym = self.dcode.decode_width(5)
- self.assert_(sym is zbar.Symbol.NONE)
- self.assert_(not sym)
+ self.assertTrue(sym is zbar.Symbol.NONE)
+ self.assertTrue(not sym)
self.assertEqual(str(sym), 'NONE')
typ = self.dcode.type
- self.assert_(sym is typ)
+ self.assertTrue(sym is typ)
def test_reset(self):
- self.assert_(self.dcode.color is zbar.SPACE)
+ self.assertTrue(self.dcode.color is zbar.SPACE)
sym = self.dcode.decode_width(1)
- self.assert_(self.dcode.color is zbar.BAR)
+ self.assertTrue(self.dcode.color is zbar.BAR)
self.dcode.reset()
- self.assert_(self.dcode.color is zbar.SPACE)
+ self.assertTrue(self.dcode.color is zbar.SPACE)
self.assertEqual(self.dcode.direction, 0)
def test_decode(self):
inline_sym = [ -1 ]
def handler(dcode, closure):
- self.assert_(dcode is self.dcode)
+ self.assertTrue(dcode is self.dcode)
if dcode.type > zbar.Symbol.PARTIAL:
inline_sym[0] = dcode.type
closure[0] += 1
@@ -196,19 +196,19 @@ class TestDecoder(ut.TestCase):
if width == ' ': continue
sym = self.dcode.decode_width(int(width))
if i < len(encoded_widths) - 1:
- self.assert_(sym is zbar.Symbol.NONE or
+ self.assertTrue(sym is zbar.Symbol.NONE or
sym is zbar.Symbol.PARTIAL)
else:
- self.assert_(sym is zbar.Symbol.EAN13)
+ self.assertTrue(sym is zbar.Symbol.EAN13)
self.assertEqual(self.dcode.configs,
set((zbar.Config.ENABLE, zbar.Config.EMIT_CHECK)))
self.assertEqual(self.dcode.modifiers, set())
self.assertEqual(self.dcode.data, '6268964977804')
- self.assert_(self.dcode.color is zbar.BAR)
+ self.assertTrue(self.dcode.color is zbar.BAR)
self.assertEqual(self.dcode.direction, 1)
- self.assert_(sym is zbar.Symbol.EAN13)
- self.assert_(inline_sym[0] is zbar.Symbol.EAN13)
+ self.assertTrue(sym is zbar.Symbol.EAN13)
+ self.assertTrue(inline_sym[0] is zbar.Symbol.EAN13)
self.assertEqual(explicit_closure, [ 2 ])
def test_databar(self):
@@ -217,15 +217,15 @@ class TestDecoder(ut.TestCase):
if width == ' ': continue
sym = self.dcode.decode_width(int(width))
if i < len(databar_widths) - 1:
- self.assert_(sym is zbar.Symbol.NONE or
+ self.assertTrue(sym is zbar.Symbol.NONE or
sym is zbar.Symbol.PARTIAL)
- self.assert_(sym is zbar.Symbol.DATABAR)
+ self.assertTrue(sym is zbar.Symbol.DATABAR)
self.assertEqual(self.dcode.get_configs(zbar.Symbol.EAN13),
set((zbar.Config.ENABLE, zbar.Config.EMIT_CHECK)))
self.assertEqual(self.dcode.modifiers, set((zbar.Modifier.GS1,)))
self.assertEqual(self.dcode.data, '0124012345678905')
- self.assert_(self.dcode.color is zbar.BAR)
+ self.assertTrue(self.dcode.color is zbar.BAR)
self.assertEqual(self.dcode.direction, 1)
# FIXME test exception during callback
@@ -238,8 +238,8 @@ class TestImage(ut.TestCase):
del(self.image)
def test_type(self):
- self.assert_(isinstance(self.image, zbar.Image))
- self.assert_(callable(self.image.convert))
+ self.assertTrue(isinstance(self.image, zbar.Image))
+ self.assertTrue(callable(self.image.convert))
def test_new(self):
self.assertEqual(self.image.format, 'Y800')
@@ -247,7 +247,7 @@ class TestImage(ut.TestCase):
self.assertEqual(self.image.crop, (0, 0, 123, 456))
image = zbar.Image()
- self.assert_(isinstance(image, zbar.Image))
+ self.assertTrue(isinstance(image, zbar.Image))
self.assertEqual(image.format, '\0\0\0\0')
self.assertEqual(image.size, (0, 0))
self.assertEqual(image.crop, (0, 0, 0, 0))
@@ -308,11 +308,11 @@ class TestImageScanner(ut.TestCase):
del(self.scn)
def test_type(self):
- self.assert_(isinstance(self.scn, zbar.ImageScanner))
- self.assert_(callable(self.scn.set_config))
- self.assert_(callable(self.scn.parse_config))
- self.assert_(callable(self.scn.enable_cache))
- self.assert_(callable(self.scn.scan))
+ self.assertTrue(isinstance(self.scn, zbar.ImageScanner))
+ self.assertTrue(callable(self.scn.set_config))
+ self.assertTrue(callable(self.scn.parse_config))
+ self.assertTrue(callable(self.scn.enable_cache))
+ self.assertTrue(callable(self.scn.scan))
def test_set_config(self):
self.scn.set_config()
@@ -339,63 +339,63 @@ class TestImageScan(ut.TestCase):
self.assertEqual(n, 1)
syms = self.image.symbols
- self.assert_(isinstance(syms, zbar.SymbolSet))
+ self.assertTrue(isinstance(syms, zbar.SymbolSet))
self.assertEqual(len(syms), 1)
i = iter(self.image)
j = iter(syms)
- self.assert_(isinstance(i, zbar.SymbolIter))
- self.assert_(isinstance(j, zbar.SymbolIter))
- symi = i.next()
- symj = j.next()
- self.assertRaises(StopIteration, i.next)
- self.assertRaises(StopIteration, j.next)
+ self.assertTrue(isinstance(i, zbar.SymbolIter))
+ self.assertTrue(isinstance(j, zbar.SymbolIter))
+ symi = next(i)
+ symj = next(j)
+ self.assertRaises(StopIteration, i.__next__)
+ self.assertRaises(StopIteration, j.__next__)
# this is the only way to obtain a Symbol,
# so test Symbol here
for sym in (symi, symj):
- self.assert_(isinstance(sym, zbar.Symbol))
- self.assert_(sym.type is zbar.Symbol.EAN13)
- self.assert_(sym.type is sym.EAN13)
+ self.assertTrue(isinstance(sym, zbar.Symbol))
+ self.assertTrue(sym.type is zbar.Symbol.EAN13)
+ self.assertTrue(sym.type is sym.EAN13)
self.assertEqual(str(sym.type), 'EAN13')
cfgs = sym.configs
- self.assert_(isinstance(cfgs, set))
+ self.assertTrue(isinstance(cfgs, set))
for cfg in cfgs:
- self.assert_(isinstance(cfg, zbar.EnumItem))
+ self.assertTrue(isinstance(cfg, zbar.EnumItem))
self.assertEqual(cfgs,
set((zbar.Config.ENABLE, zbar.Config.EMIT_CHECK)))
mods = sym.modifiers
- self.assert_(isinstance(mods, set))
+ self.assertTrue(isinstance(mods, set))
for mod in mods:
- self.assert_(isinstance(mod, zbar.EnumItem))
+ self.assertTrue(isinstance(mod, zbar.EnumItem))
self.assertEqual(mods, set())
- self.assert_(sym.quality > 0)
+ self.assertTrue(sym.quality > 0)
self.assertEqual(sym.count, 0)
# FIXME put a nice QR S-A in here
comps = sym.components
- self.assert_(isinstance(comps, zbar.SymbolSet))
+ self.assertTrue(isinstance(comps, zbar.SymbolSet))
self.assertEqual(len(comps), 0)
- self.assert_(not comps)
- self.assert_(tuple(comps) is ())
+ self.assertTrue(not comps)
+ self.assertTrue(tuple(comps) is ())
data = sym.data
self.assertEqual(data, '9876543210128')
loc = sym.location
- self.assert_(len(loc) >= 4) # FIXME
- self.assert_(isinstance(loc, tuple))
+ self.assertTrue(len(loc) >= 4) # FIXME
+ self.assertTrue(isinstance(loc, tuple))
for pt in loc:
- self.assert_(isinstance(pt, tuple))
+ self.assertTrue(isinstance(pt, tuple))
self.assertEqual(len(pt), 2)
# FIXME test values (API currently in flux)
- self.assert_(sym.orientation is zbar.Orient.UP)
- self.assert_(data is sym.data)
- self.assert_(loc is sym.location)
+ self.assertTrue(sym.orientation is zbar.Orient.UP)
+ self.assertTrue(data is sym.data)
+ self.assertTrue(loc is sym.location)
def set_symbols(syms):
self.image.symbols = syms
@@ -430,14 +430,14 @@ class TestProcessor(ut.TestCase):
del(self.proc)
def test_type(self):
- self.assert_(isinstance(self.proc, zbar.Processor))
- self.assert_(callable(self.proc.init))
- self.assert_(callable(self.proc.set_config))
- self.assert_(callable(self.proc.parse_config))
- self.assert_(callable(self.proc.set_data_handler))
- self.assert_(callable(self.proc.user_wait))
- self.assert_(callable(self.proc.process_one))
- self.assert_(callable(self.proc.process_image))
+ self.assertTrue(isinstance(self.proc, zbar.Processor))
+ self.assertTrue(callable(self.proc.init))
+ self.assertTrue(callable(self.proc.set_config))
+ self.assertTrue(callable(self.proc.parse_config))
+ self.assertTrue(callable(self.proc.set_data_handler))
+ self.assertTrue(callable(self.proc.user_wait))
+ self.assertTrue(callable(self.proc.process_one))
+ self.assertTrue(callable(self.proc.process_image))
def test_set_config(self):
self.proc.set_config()
@@ -461,31 +461,31 @@ class TestProcessor(ut.TestCase):
def test_processing(self):
self.proc.init(VIDEO_DEVICE)
- self.assert_(self.proc.visible is False)
+ self.assertTrue(self.proc.visible is False)
self.proc.visible = 1
- self.assert_(self.proc.visible is True)
+ self.assertTrue(self.proc.visible is True)
self.assertEqual(self.proc.user_wait(1.1), 0)
self.image = zbar.Image(size[0], size[1], 'Y800', data)
count = [ 0 ]
def data_handler(proc, image, closure):
- self.assert_(proc is self.proc)
- self.assert_(image is self.image)
+ self.assertTrue(proc is self.proc)
+ self.assertTrue(image is self.image)
self.assertEqual(count[0], 0)
count[0] += 1
symiter = iter(image)
- self.assert_(isinstance(symiter, zbar.SymbolIter))
+ self.assertTrue(isinstance(symiter, zbar.SymbolIter))
syms = tuple(image)
self.assertEqual(len(syms), 1)
for sym in syms:
- self.assert_(isinstance(sym, zbar.Symbol))
- self.assert_(sym.type is zbar.Symbol.EAN13)
+ self.assertTrue(isinstance(sym, zbar.Symbol))
+ self.assertTrue(sym.type is zbar.Symbol.EAN13)
self.assertEqual(sym.data, '9876543210128')
- self.assert_(sym.quality > 0)
- self.assert_(sym.orientation is zbar.Orient.UP)
+ self.assertTrue(sym.quality > 0)
+ self.assertTrue(sym.orientation is zbar.Orient.UP)
closure[0] += 1
explicit_closure = [ 0 ]
Loading…
Cancel
Save