11import logging
22import os
3+ from itertools import product
34from tempfile import mkdtemp
45
56from PIL import Image
@@ -99,10 +100,10 @@ def test_decoding_multiple():
99100 '{}: Expected {!r} but got {!r}' .format (filename , expected_format , dec .format ))
100101
101102
102- @params (False , True )
103- def test_parsing (with_raw_bits ):
103+ @params (* product (( False , True ), repeat = 2 ) )
104+ def test_parsing (with_raw_bits , with_netloc ):
104105 stdout = ("""
105- file:///tmp/default%20file.png (format: FAKE_DATA, type: TEXT):
106+ file://""" ) + ( "NETWORK_SHARE" if with_netloc else "" ) + ( """ /tmp/default%20file.png (format: FAKE_DATA, type: TEXT):
106107Raw result:
107108Élan|\t the barcode is taking off
108109Parsed result:
@@ -117,8 +118,8 @@ def test_parsing(with_raw_bits):
117118 Point 3: (205.23952,21.0)
118119""" )
119120 dec = zxing .BarCode .parse (stdout .encode ())
120- assert dec .uri == 'file:///tmp/default%20file.png'
121- assert dec .path == '/tmp/default file.png'
121+ assert dec .uri == 'file://' + ( "NETWORK_SHARE" if with_netloc else "" ) + ' /tmp/default%20file.png'
122+ assert dec .path == ( None if with_netloc else '/tmp/default file.png' )
122123 assert dec .format == 'FAKE_DATA'
123124 assert dec .type == 'TEXT'
124125 assert dec .raw == 'Élan|\t the barcode is taking off'
0 commit comments