Skip to content

Commit c2c6569

Browse files
committed
Use 'assert EXPR, MESSAGE' in tests, and call it v0.14
1 parent a71f6ae commit c2c6569

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

test/test_all.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ def _check_decoding(filename, expected_format, expected_raw, extra={}):
4949
logging.debug('Trying to parse {}, expecting {!r}.'.format(path, expected_raw))
5050
dec = test_reader.decode(path, pure_barcode=True, **extra)
5151
if expected_raw is None:
52-
if dec.raw is not None:
53-
raise AssertionError('Expected failure, but got result in {} format'.format(expected_format, dec.format))
52+
assert dec.raw is None, (
53+
'Expected failure, but got result in {} format'.format(expected_format, dec.format))
5454
else:
55-
if dec.raw != expected_raw:
56-
raise AssertionError('Expected {!r} but got {!r}'.format(expected_raw, dec.raw))
57-
if dec.format != expected_format:
58-
raise AssertionError('Expected {!r} but got {!r}'.format(expected_format, dec.format))
55+
assert dec.raw == expected_raw, (
56+
'Expected {!r} but got {!r}'.format(expected_raw, dec.raw))
57+
assert dec.format == expected_format, (
58+
'Expected {!r} but got {!r}'.format(expected_format, dec.format))
5959

6060

6161
def test_decoding():
@@ -73,10 +73,10 @@ def test_decoding_multiple():
7373
global test_reader
7474
filenames = [os.path.join(test_barcode_dir, filename) for filename, expected_format, expected_raw in test_valid_images]
7575
for dec, (filename, expected_format, expected_raw) in zip(test_reader.decode(filenames, pure_barcode=True), test_valid_images):
76-
if dec.raw != expected_raw:
77-
raise AssertionError('{}: Expected {!r} but got {!r}'.format(filename, expected_raw, dec.parsed))
78-
if dec.format != expected_format:
79-
raise AssertionError('{}: Expected {!r} but got {!r}'.format(filename, expected_format, dec.format))
76+
assert dec.raw == expected_raw, (
77+
'{}: Expected {!r} but got {!r}'.format(filename, expected_raw, dec.parsed))
78+
assert dec.format == expected_format, (
79+
'{}: Expected {!r} but got {!r}'.format(filename, expected_format, dec.format))
8080

8181

8282
def test_parsing():

zxing/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.13.1"
1+
__version__ = "0.14"

0 commit comments

Comments
 (0)