@@ -278,8 +278,8 @@ def test_excel_report_setting_template():
278
278
# test setting template dir
279
279
# 1) wrong template dir
280
280
wrong_template_dir = r"C:\Wrong\Directory\Path"
281
- msg = "Template directory {} could not been found" .format (wrong_template_dir )
282
- with pytest .raises (ValueError , message = msg ):
281
+ msg = "The directory {} could not be found" .format (wrong_template_dir )
282
+ with pytest .raises (ValueError , match = re . escape ( msg ) ):
283
283
excel_report .template_dir = wrong_template_dir
284
284
# 2) correct path
285
285
excel_report .template_dir = EXAMPLE_EXCEL_TEMPLATES_DIR
@@ -288,8 +288,8 @@ def test_excel_report_setting_template():
288
288
# test setting template file
289
289
# 1) wrong extension
290
290
template_file = 'wrong_extension.txt'
291
- msg = "Extension for the template file must be '.crtx' instead of .txt"
292
- with pytest .raises (ValueError , message = msg ):
291
+ msg = "Extension for the excel template file must be '.crtx' instead of .txt"
292
+ with pytest .raises (ValueError , match = re . escape ( msg ) ):
293
293
excel_report .template = template_file
294
294
# 2) add .crtx extension if no extension
295
295
template_name = 'Line'
@@ -365,11 +365,11 @@ def test_excel_report_arrays():
365
365
366
366
# test setting default size
367
367
# 1) pass a not registered kind of item
368
- type_item = 'unknown_item'
369
- msg = "Type item {} is not registered. Please choose in " \
370
- "list ['title', 'graph']" .format (type_item )
371
- with pytest .raises (ValueError , message = msg ):
372
- sheet_graphs .set_item_default_size (type_item , width , height )
368
+ item_type = 'unknown_item'
369
+ msg = "Item type {} is not registered. Please choose in " \
370
+ "list ['title', 'graph']" .format (item_type )
371
+ with pytest .raises (ValueError , match = re . escape ( msg ) ):
372
+ sheet_graphs .set_item_default_size (item_type , width , height )
373
373
# 2) update default size for graphs
374
374
sheet_graphs .set_item_default_size ('graph' , width , height )
375
375
sheet_graphs .add_title ('Using Defined Sizes For All Graphs' )
0 commit comments