Skip to content

Commit 767e408

Browse files
author
Steve Canny
committed
test: extract unitutil.mock and unitutil.file
1 parent 158f212 commit 767e408

23 files changed

+64
-69
lines changed

tests/image/test_bmp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from docx.image.constants import MIME_TYPE
1313
from docx.image.bmp import Bmp
1414

15-
from ..unitutil import initializer_mock
15+
from ..unitutil.mock import initializer_mock
1616

1717

1818
class DescribeBmp(object):

tests/image/test_gif.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from docx.image.constants import MIME_TYPE
1313
from docx.image.gif import Gif
1414

15-
from ..unitutil import initializer_mock
15+
from ..unitutil.mock import initializer_mock
1616

1717

1818
class DescribeGif(object):

tests/image/test_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from docx.image.tiff import Tiff
1919
from docx.opc.constants import CONTENT_TYPE as CT
2020

21-
from ..unitutil import (
22-
function_mock, class_mock, initializer_mock, instance_mock, method_mock,
23-
test_file
21+
from ..unitutil.file import test_file
22+
from ..unitutil.mock import (
23+
function_mock, class_mock, initializer_mock, instance_mock, method_mock
2424
)
2525

2626

tests/image/test_jpeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from docx.image.tiff import Tiff
1919

20-
from ..unitutil import (
20+
from ..unitutil.mock import (
2121
call, class_mock, initializer_mock, instance_mock, method_mock
2222
)
2323

tests/image/test_png.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Png, _PngParser
1818
)
1919

20-
from ..unitutil import (
20+
from ..unitutil.mock import (
2121
call, class_mock, function_mock, initializer_mock, instance_mock,
2222
method_mock
2323
)

tests/image/test_tiff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
_LongIfdEntry, _RationalIfdEntry, _ShortIfdEntry, Tiff, _TiffParser
1717
)
1818

19-
from ..unitutil import (
19+
from ..unitutil.mock import (
2020
call, class_mock, function_mock, initializer_mock, instance_mock,
2121
loose_mock, method_mock
2222
)

tests/opc/test_oxml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from docx.opc.oxml import (
99
CT_Default, CT_Override, CT_Relationship, CT_Relationships, CT_Types
1010
)
11+
from docx.oxml.xmlchemy import serialize_for_reading
1112

12-
from ..unitutil import actual_xml
1313
from .unitdata.rels import (
1414
a_Default, an_Override, a_Relationship, a_Relationships, a_Types
1515
)
@@ -76,7 +76,7 @@ def it_can_construct_a_new_relationships_element(self):
7676
'<Relationships xmlns="http://schemas.openxmlformats.org/package'
7777
'/2006/relationships"/>\n'
7878
)
79-
assert actual_xml(rels) == expected_xml
79+
assert serialize_for_reading(rels) == expected_xml
8080

8181
def it_can_build_rels_element_incrementally(self):
8282
# setup ------------------------
@@ -87,7 +87,7 @@ def it_can_build_rels_element_incrementally(self):
8787
rels.add_rel('rId3', 'http://reltype2', '../slides/slide1.xml')
8888
# verify -----------------------
8989
expected_rels_xml = a_Relationships().xml
90-
assert actual_xml(rels) == expected_rels_xml
90+
assert serialize_for_reading(rels) == expected_rels_xml
9191

9292
def it_can_generate_rels_file_xml(self):
9393
expected_xml = (

tests/opc/test_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
from docx.opc.pkgreader import PackageReader
1818

19-
from ..unitutil import (
19+
from ..unitutil.mock import (
2020
call, class_mock, cls_attr_mock, function_mock, instance_mock,
2121
loose_mock, method_mock, Mock, patch, PropertyMock
2222
)

tests/opc/test_phys_pkg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
_DirPkgReader, PhysPkgReader, PhysPkgWriter, _ZipPkgReader, _ZipPkgWriter
2323
)
2424

25-
from ..unitutil import absjoin, class_mock, loose_mock, Mock, test_file_dir
25+
from ..unitutil.file import absjoin, test_file_dir
26+
from ..unitutil.mock import class_mock, loose_mock, Mock
2627

2728

2829
test_docx_path = absjoin(test_file_dir, 'test.docx')

tests/opc/test_pkgreader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
)
2020

2121
from .unitdata.types import a_Default, a_Types, an_Override
22-
from ..unitutil import (
22+
from ..unitutil.mock import (
2323
call, class_mock, function_mock, initializer_mock, instance_mock,
2424
loose_mock, method_mock, Mock, patch
2525
)

0 commit comments

Comments
 (0)