File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ dependencies = [
1818 " platformdirs" ,
1919 " Pillow>=8.1.2,<11" ,
2020 " PyQRCode>=1.2.1,<2" ,
21- " python-barcode>=0.13.1,<0.16 " ,
21+ " python-barcode>=0.13.1" ,
2222 " pyusb" ,
2323 " PyQt6" ,
2424 " darkdetect" ,
Original file line number Diff line number Diff line change 1414"""A string that's been validated to contain only '0's and '1's."""
1515
1616
17+ def _noop () -> None :
18+ pass
19+
20+
1721def _validate_string_as_binary (s : str ) -> BinaryString :
1822 if not all (c in ("0" , "1" ) for c in s ):
1923 raise ValueError ("Barcode can only contain 0 and 1" )
@@ -26,6 +30,15 @@ class BarcodeResult(NamedTuple):
2630
2731
2832class SimpleBarcodeWriter (BaseWriter ):
33+ def __init__ (self ) -> None :
34+ # Pass dummy values because we re-implement the `render` method anyway
35+ super ().__init__ (
36+ initialize = None ,
37+ paint_module = _noop ,
38+ paint_text = None ,
39+ finish = _noop ,
40+ )
41+
2942 def render (self , code : List [str ]) -> BarcodeResult :
3043 """Extract the barcode string from the code and render it into an image."""
3144 if len (code ) != 1 :
Original file line number Diff line number Diff line change @@ -130,9 +130,8 @@ def test_barcode_render_engine_internal_error():
130130 )
131131 with pytest .raises (BarcodeRenderError ) as exc_info :
132132 render_engine .render (RENDER_CONTEXT )
133- assert (
134- str (exc_info .value ) == "Barcode render error: IllegalCharacterError("
135- "'EAN code can only contain numbers.')"
133+ assert str (exc_info .value ).startswith (
134+ "Barcode render error: IllegalCharacterError('EAN code can only contain numbers"
136135 )
137136
138137
You can’t perform that action at this time.
0 commit comments