99from docx .shared import Inches
1010from docx .table import Table
1111
12- from helpers import test_file_path
12+ from helpers import test_file
1313
1414
1515# when ====================================================
@@ -70,7 +70,7 @@ def when_add_paragraph_without_specifying_text_or_style(context):
7070def when_add_picture_specifying_width_and_height (context ):
7171 document = context .document
7272 context .picture = document .add_picture (
73- test_file_path ('monty-truth.png' ),
73+ test_file ('monty-truth.png' ),
7474 width = Inches (1.75 ), height = Inches (2.5 )
7575 )
7676
@@ -79,22 +79,22 @@ def when_add_picture_specifying_width_and_height(context):
7979def when_add_picture_specifying_height (context ):
8080 document = context .document
8181 context .picture = document .add_picture (
82- test_file_path ('monty-truth.png' ), height = Inches (1.5 )
82+ test_file ('monty-truth.png' ), height = Inches (1.5 )
8383 )
8484
8585
8686@when ('I add a picture specifying a width of 1.5 inches' )
8787def when_add_picture_specifying_width (context ):
8888 document = context .document
8989 context .picture = document .add_picture (
90- test_file_path ('monty-truth.png' ), width = Inches (1.5 )
90+ test_file ('monty-truth.png' ), width = Inches (1.5 )
9191 )
9292
9393
9494@when ('I add a picture specifying only the image file' )
9595def when_add_picture_specifying_only_image_file (context ):
9696 document = context .document
97- context .picture = document .add_picture (test_file_path ('monty-truth.png' ))
97+ context .picture = document .add_picture (test_file ('monty-truth.png' ))
9898
9999
100100# then =====================================================
@@ -149,37 +149,6 @@ def then_last_p_is_empty_paragraph_added(context):
149149 assert p .text == ''
150150
151151
152- @then ('the picture has its native width and height' )
153- def then_picture_has_native_width_and_height (context ):
154- picture = context .picture
155- assert picture .width == 1905000 , 'got %d' % picture .width
156- assert picture .height == 2717800 , 'got %d' % picture .height
157-
158-
159- @then ('the picture height is 2.14 inches' )
160- def then_picture_height_is_value_2 (context ):
161- picture = context .picture
162- assert picture .height == 1956816 , 'got %d' % picture .height
163-
164-
165- @then ('the picture height is 2.5 inches' )
166- def then_picture_height_is_value (context ):
167- picture = context .picture
168- assert picture .height == 2286000 , 'got %d' % picture .height
169-
170-
171- @then ('the picture width is 1.05 inches' )
172- def then_picture_width_is_value_2 (context ):
173- picture = context .picture
174- assert picture .width == 961402 , 'got %d' % picture .width
175-
176-
177- @then ('the picture width is 1.75 inches' )
178- def then_picture_width_is_value (context ):
179- picture = context .picture
180- assert picture .width == 1600200 , 'got %d' % picture .width
181-
182-
183152@then ('the style of the last paragraph is \' {style}\' ' )
184153def then_style_of_last_paragraph_is_style (context , style ):
185154 document = context .document
0 commit comments