Description: Removing images of unclear copyright.
Author: Andrius Merkys <merkys@debian.org>
Bug: https://github.com/python-openxml/python-docx/issues/1019
Forwarded: not-needed
--- a/features/img-characterize-image.feature
+++ b/features/img-characterize-image.feature
@@ -14,14 +14,3 @@
 
    Examples: Image file characteristics
      | filename         | mime_type  |  cx  |  cy  | horz_dpi | vert_dpi |
-     | test.png         | image/png  |  901 | 1350 |   150    |   150    |
-     | monty-truth.png  | image/png  |  150 |  214 |    72    |    72    |
-     | jfif-300-dpi.jpg | image/jpeg | 1504 | 1936 |   300    |   300    |
-     | lena_std.jpg     | image/jpeg |  512 |  512 |    72    |    72    |
-     | lena.tif         | image/tiff |  512 |  512 |    72    |    72    |
-     | sample.tif       | image/tiff | 1600 | 2100 |   200    |   200    |
-     | jpeg420exif.jpg  | image/jpeg | 2048 | 1536 |    72    |    72    |
-     | court-exif.jpg   | image/jpeg |  500 |  375 |   256    |   256    |
-     | lena.gif         | image/gif  |  256 |  256 |    72    |    72    |
-     | lena.bmp         | image/bmp  |  512 |  512 |    96    |    96    |
-     | mountain.bmp     | image/bmp  |  640 |  480 |   300    |   300    |
--- a/features/doc-add-picture.feature
+++ /dev/null
@@ -1,30 +0,0 @@
-Feature: Append an inline picture in its own paragraph
-  In order add an image to a document
-  As a developer using python-docx
-  I need a way to add a picture in its own paragraph
-
-
-  Scenario: Add a picture at native size
-    Given a blank document
-     When I add a picture specifying only the image file
-     Then the document contains the inline picture
-      And the picture has its native width and height
-
-
-  Scenario: Add a picture specifying both width and height
-    Given a blank document
-     When I add a picture specifying 1.75" width and 2.5" height
-     Then picture.width is 1.75 inches
-      And picture.height is 2.5 inches
-
-
-  Scenario: Add a picture specifying only width
-    Given a blank document
-     When I add a picture specifying a width of 1.5 inches
-     Then picture.height is 2.14 inches
-
-
-  Scenario: Add a picture specifying only height
-    Given a blank document
-     When I add a picture specifying a height of 1.5 inches
-     Then picture.width is 1.05 inches
--- a/features/hdr-header-footer.feature
+++ b/features/hdr-header-footer.feature
@@ -40,12 +40,6 @@
      Then header.paragraphs[0].style.name == "Normal"
 
 
-  Scenario: _Header allows image insertion
-    Given a _Run object from a header as run
-     When I call run.add_picture()
-     Then I can't detect the image but no exception is raised
-
-
   Scenario Outline: _Footer.is_linked_to_previous getter
     Given a _Footer object <with-or-no> footer definition as footer
      Then footer.is_linked_to_previous is <value>
@@ -80,9 +74,3 @@
     Given a _Footer object with a footer definition as footer
      When I assign "Normal" to footer.paragraphs[0].style
      Then footer.paragraphs[0].style.name == "Normal"
-
-
-  Scenario: _Footer allows image insertion
-    Given a _Run object from a footer as run
-     When I call run.add_picture()
-     Then I can't detect the image but no exception is raised
--- a/features/run-add-picture.feature
+++ /dev/null
@@ -1,24 +0,0 @@
-Feature: Add picture to a run
-  In order to place an inline picture at an arbitrary place in a document
-  As a developer using python-docx
-  I need a way to add a picture to a run
-
-
-  Scenario: Add a picture to a body paragraph run
-    Given a run
-     When I add a picture to the run
-     Then the picture appears at the end of the run
-      And the document contains the inline picture
-
-
-  Scenario Outline: Add a picture to a run in a table cell
-    Given a run inside a table cell retrieved from <cell-source>
-     When I add a picture to the run
-     Then the picture appears at the end of the run
-      And the document contains the inline picture
-
-    Examples: Table cell sources
-      | cell-source        |
-      | Table.cell         |
-      | Table.row.cells    |
-      | Table.column.cells |
--- a/tests/image/test_image.py
+++ /dev/null
@@ -1,324 +0,0 @@
-"""Unit test suite for docx.image package"""
-
-import io
-
-import pytest
-
-from docx.image.bmp import Bmp
-from docx.image.exceptions import UnrecognizedImageError
-from docx.image.gif import Gif
-from docx.image.image import BaseImageHeader, Image, _ImageHeaderFactory
-from docx.image.jpeg import Exif, Jfif
-from docx.image.png import Png
-from docx.image.tiff import Tiff
-from docx.opc.constants import CONTENT_TYPE as CT
-from docx.shared import Emu, Length
-
-from ..unitutil.file import test_file
-from ..unitutil.mock import (
-    ANY,
-    class_mock,
-    function_mock,
-    initializer_mock,
-    instance_mock,
-    method_mock,
-    property_mock,
-)
-
-
-class DescribeImage:
-    def it_can_construct_from_an_image_blob(
-        self, blob_, BytesIO_, _from_stream_, stream_, image_
-    ):
-        image = Image.from_blob(blob_)
-
-        BytesIO_.assert_called_once_with(blob_)
-        _from_stream_.assert_called_once_with(stream_, blob_)
-        assert image is image_
-
-    def it_can_construct_from_an_image_path(self, from_path_fixture):
-        image_path, _from_stream_, stream_, blob, filename, image_ = from_path_fixture
-        image = Image.from_file(image_path)
-        _from_stream_.assert_called_once_with(stream_, blob, filename)
-        assert image is image_
-
-    def it_can_construct_from_an_image_file_like(self, from_filelike_fixture):
-        image_stream, _from_stream_, blob, image_ = from_filelike_fixture
-        image = Image.from_file(image_stream)
-        _from_stream_.assert_called_once_with(image_stream, blob, None)
-        assert image is image_
-
-    def it_can_construct_from_an_image_stream(self, from_stream_fixture):
-        stream_, blob_, filename_in = from_stream_fixture[:3]
-        _ImageHeaderFactory_, image_header_ = from_stream_fixture[3:5]
-        Image__init_, filename_out = from_stream_fixture[5:]
-
-        image = Image._from_stream(stream_, blob_, filename_in)
-
-        _ImageHeaderFactory_.assert_called_once_with(stream_)
-        Image__init_.assert_called_once_with(ANY, blob_, filename_out, image_header_)
-        assert isinstance(image, Image)
-
-    def it_provides_access_to_the_image_blob(self):
-        blob = b"foobar"
-        image = Image(blob, None, None)
-        assert image.blob == blob
-
-    def it_knows_the_image_content_type(self, content_type_fixture):
-        image_header_, content_type = content_type_fixture
-        image = Image(None, None, image_header_)
-        assert image.content_type == content_type
-
-    def it_knows_the_image_px_dimensions(self, dimensions_fixture):
-        image_header_, px_width, px_height = dimensions_fixture
-        image = Image(None, None, image_header_)
-        assert image.px_width == px_width
-        assert image.px_height == px_height
-
-    def it_knows_the_horz_and_vert_dpi_of_the_image(self, dpi_fixture):
-        image_header_, horz_dpi, vert_dpi = dpi_fixture
-        image = Image(None, None, image_header_)
-        assert image.horz_dpi == horz_dpi
-        assert image.vert_dpi == vert_dpi
-
-    def it_knows_the_image_native_size(self, size_fixture):
-        image, width, height = size_fixture
-        assert (image.width, image.height) == (width, height)
-        assert isinstance(image.width, Length)
-        assert isinstance(image.height, Length)
-
-    def it_can_scale_its_dimensions(self, scale_fixture):
-        image, width, height, expected_value = scale_fixture
-
-        scaled_width, scaled_height = image.scaled_dimensions(width, height)
-
-        assert (scaled_width, scaled_height) == expected_value
-        assert isinstance(scaled_width, Length)
-        assert isinstance(scaled_height, Length)
-
-    def it_knows_the_image_filename(self):
-        filename = "foobar.png"
-        image = Image(None, filename, None)
-        assert image.filename == filename
-
-    def it_knows_the_image_filename_extension(self):
-        image = Image(None, "foobar.png", None)
-        assert image.ext == "png"
-
-    def it_knows_the_sha1_of_its_image(self):
-        blob = b"fO0Bar"
-        image = Image(blob, None, None)
-        assert image.sha1 == "4921e7002ddfba690a937d54bda226a7b8bdeb68"
-
-    def it_correctly_characterizes_known_images(self, known_image_fixture):
-        image_path, characteristics = known_image_fixture
-        ext, content_type, px_width, px_height, horz_dpi, vert_dpi = characteristics
-        with open(test_file(image_path), "rb") as stream:
-            image = Image.from_file(stream)
-            assert image.content_type == content_type
-            assert image.ext == ext
-            assert image.px_width == px_width
-            assert image.px_height == px_height
-            assert image.horz_dpi == horz_dpi
-            assert image.vert_dpi == vert_dpi
-
-    # fixtures -------------------------------------------------------
-
-    @pytest.fixture
-    def content_type_fixture(self, image_header_):
-        content_type = "image/foobar"
-        image_header_.content_type = content_type
-        return image_header_, content_type
-
-    @pytest.fixture
-    def dimensions_fixture(self, image_header_):
-        px_width, px_height = 111, 222
-        image_header_.px_width = px_width
-        image_header_.px_height = px_height
-        return image_header_, px_width, px_height
-
-    @pytest.fixture
-    def dpi_fixture(self, image_header_):
-        horz_dpi, vert_dpi = 333, 444
-        image_header_.horz_dpi = horz_dpi
-        image_header_.vert_dpi = vert_dpi
-        return image_header_, horz_dpi, vert_dpi
-
-    @pytest.fixture
-    def from_filelike_fixture(self, _from_stream_, image_):
-        image_path = test_file("python-icon.png")
-        with open(image_path, "rb") as f:
-            blob = f.read()
-        image_stream = io.BytesIO(blob)
-        return image_stream, _from_stream_, blob, image_
-
-    @pytest.fixture
-    def from_path_fixture(self, _from_stream_, BytesIO_, stream_, image_):
-        filename = "python-icon.png"
-        image_path = test_file(filename)
-        with open(image_path, "rb") as f:
-            blob = f.read()
-        return image_path, _from_stream_, stream_, blob, filename, image_
-
-    @pytest.fixture(params=["foobar.png", None])
-    def from_stream_fixture(
-        self, request, stream_, blob_, _ImageHeaderFactory_, image_header_, Image__init_
-    ):
-        filename_in = request.param
-        filename_out = "image.png" if filename_in is None else filename_in
-        return (
-            stream_,
-            blob_,
-            filename_in,
-            _ImageHeaderFactory_,
-            image_header_,
-            Image__init_,
-            filename_out,
-        )
-
-    @pytest.fixture(params=[0, 1, 2, 3, 4, 5, 6, 7, 8])
-    def known_image_fixture(self, request):
-        cases = (
-            ("python.bmp", ("bmp", CT.BMP, 211, 71, 96, 96)),
-            ("sonic.gif", ("gif", CT.GIF, 290, 360, 72, 72)),
-            ("python-icon.jpeg", ("jpg", CT.JPEG, 204, 204, 72, 72)),
-            ("300-dpi.jpg", ("jpg", CT.JPEG, 1504, 1936, 300, 300)),
-            ("monty-truth.png", ("png", CT.PNG, 150, 214, 72, 72)),
-            ("150-dpi.png", ("png", CT.PNG, 901, 1350, 150, 150)),
-            ("300-dpi.png", ("png", CT.PNG, 860, 579, 300, 300)),
-            ("72-dpi.tiff", ("tiff", CT.TIFF, 48, 48, 72, 72)),
-            ("300-dpi.TIF", ("tiff", CT.TIFF, 2464, 3248, 300, 300)),
-            # ('CVS_LOGO.WMF',     ('wmf',  CT.X_WMF, 149,   59,  72,  72)),
-        )
-        image_filename, characteristics = cases[request.param]
-        return image_filename, characteristics
-
-    @pytest.fixture(
-        params=[
-            (None, None, 1000, 2000),
-            (100, None, 100, 200),
-            (None, 500, 250, 500),
-            (1500, 1500, 1500, 1500),
-        ]
-    )
-    def scale_fixture(self, request, width_prop_, height_prop_):
-        width, height, scaled_width, scaled_height = request.param
-        width_prop_.return_value = Emu(1000)
-        height_prop_.return_value = Emu(2000)
-        image = Image(None, None, None)
-        return image, width, height, (scaled_width, scaled_height)
-
-    @pytest.fixture
-    def size_fixture(self, image_header_):
-        image_header_.px_width, image_header_.px_height = 150, 75
-        image_header_.horz_dpi, image_header_.vert_dpi = 72, 200
-        image = Image(None, None, image_header_)
-        return image, 1905000, 342900
-
-    # fixture components ---------------------------------------------
-
-    @pytest.fixture
-    def blob_(self, request):
-        return instance_mock(request, bytes)
-
-    @pytest.fixture
-    def BytesIO_(self, request, stream_):
-        return class_mock(request, "docx.image.image.io.BytesIO", return_value=stream_)
-
-    @pytest.fixture
-    def filename_(self, request):
-        return instance_mock(request, str)
-
-    @pytest.fixture
-    def _from_stream_(self, request, image_):
-        return method_mock(
-            request, Image, "_from_stream", autospec=False, return_value=image_
-        )
-
-    @pytest.fixture
-    def height_prop_(self, request):
-        return property_mock(request, Image, "height")
-
-    @pytest.fixture
-    def image_(self, request):
-        return instance_mock(request, Image)
-
-    @pytest.fixture
-    def _ImageHeaderFactory_(self, request, image_header_):
-        return function_mock(
-            request, "docx.image.image._ImageHeaderFactory", return_value=image_header_
-        )
-
-    @pytest.fixture
-    def image_header_(self, request):
-        return instance_mock(request, BaseImageHeader, default_ext="png")
-
-    @pytest.fixture
-    def Image__init_(self, request):
-        return initializer_mock(request, Image)
-
-    @pytest.fixture
-    def stream_(self, request):
-        return instance_mock(request, io.BytesIO)
-
-    @pytest.fixture
-    def width_prop_(self, request):
-        return property_mock(request, Image, "width")
-
-
-class Describe_ImageHeaderFactory:
-    def it_constructs_the_right_class_for_a_given_image_stream(self, call_fixture):
-        stream, expected_class = call_fixture
-        image_header = _ImageHeaderFactory(stream)
-        assert isinstance(image_header, expected_class)
-
-    def it_raises_on_unrecognized_image_stream(self):
-        stream = io.BytesIO(b"foobar 666 not an image stream")
-        with pytest.raises(UnrecognizedImageError):
-            _ImageHeaderFactory(stream)
-
-    # fixtures -------------------------------------------------------
-
-    @pytest.fixture(
-        params=[
-            ("python-icon.png", Png),
-            ("python-icon.jpeg", Jfif),
-            ("exif-420-dpi.jpg", Exif),
-            ("sonic.gif", Gif),
-            ("72-dpi.tiff", Tiff),
-            ("little-endian.tif", Tiff),
-            ("python.bmp", Bmp),
-        ]
-    )
-    def call_fixture(self, request):
-        image_filename, expected_class = request.param
-        image_path = test_file(image_filename)
-        with open(image_path, "rb") as f:
-            blob = f.read()
-        image_stream = io.BytesIO(blob)
-        image_stream.seek(666)
-        return image_stream, expected_class
-
-
-class DescribeBaseImageHeader:
-    def it_defines_content_type_as_an_abstract_property(self):
-        base_image_header = BaseImageHeader(None, None, None, None)
-        with pytest.raises(NotImplementedError):
-            base_image_header.content_type
-
-    def it_defines_default_ext_as_an_abstract_property(self):
-        base_image_header = BaseImageHeader(None, None, None, None)
-        with pytest.raises(NotImplementedError):
-            base_image_header.default_ext
-
-    def it_knows_the_image_dimensions(self):
-        px_width, px_height = 42, 24
-        image_header = BaseImageHeader(px_width, px_height, None, None)
-        assert image_header.px_width == px_width
-        assert image_header.px_height == px_height
-
-    def it_knows_the_horz_and_vert_dpi_of_the_image(self):
-        horz_dpi, vert_dpi = 42, 24
-        image_header = BaseImageHeader(None, None, horz_dpi, vert_dpi)
-        assert image_header.horz_dpi == horz_dpi
-        assert image_header.vert_dpi == vert_dpi
--- a/tests/parts/test_image.py
+++ /dev/null
@@ -1,111 +0,0 @@
-"""Unit test suite for docx.parts.image module."""
-
-import pytest
-
-from docx.image.image import Image
-from docx.opc.constants import CONTENT_TYPE as CT
-from docx.opc.constants import RELATIONSHIP_TYPE as RT
-from docx.opc.packuri import PackURI
-from docx.opc.part import PartFactory
-from docx.package import Package
-from docx.parts.image import ImagePart
-
-from ..unitutil.file import test_file
-from ..unitutil.mock import ANY, initializer_mock, instance_mock, method_mock
-
-
-class DescribeImagePart:
-    def it_is_used_by_PartFactory_to_construct_image_part(
-        self, image_part_load_, partname_, blob_, package_, image_part_
-    ):
-        content_type = CT.JPEG
-        reltype = RT.IMAGE
-        image_part_load_.return_value = image_part_
-
-        part = PartFactory(partname_, content_type, reltype, blob_, package_)
-
-        image_part_load_.assert_called_once_with(
-            partname_, content_type, blob_, package_
-        )
-        assert part is image_part_
-
-    def it_can_construct_from_an_Image_instance(self, image_, partname_, _init_):
-        image_part = ImagePart.from_image(image_, partname_)
-
-        _init_.assert_called_once_with(
-            ANY, partname_, image_.content_type, image_.blob, image_
-        )
-        assert isinstance(image_part, ImagePart)
-
-    def it_knows_its_default_dimensions_in_EMU(self, dimensions_fixture):
-        image_part, cx, cy = dimensions_fixture
-        assert image_part.default_cx == cx
-        assert image_part.default_cy == cy
-
-    def it_knows_its_filename(self, filename_fixture):
-        image_part, expected_filename = filename_fixture
-        assert image_part.filename == expected_filename
-
-    def it_knows_the_sha1_of_its_image(self):
-        blob = b"fO0Bar"
-        image_part = ImagePart(None, None, blob)
-        assert image_part.sha1 == "4921e7002ddfba690a937d54bda226a7b8bdeb68"
-
-    # fixtures -------------------------------------------------------
-
-    @pytest.fixture
-    def blob_(self, request):
-        return instance_mock(request, str)
-
-    @pytest.fixture(params=["loaded", "new"])
-    def dimensions_fixture(self, request):
-        image_file_path = test_file("monty-truth.png")
-        image = Image.from_file(image_file_path)
-        expected_cx, expected_cy = 1905000, 2717800
-
-        # case 1: image part is loaded by PartFactory w/no Image inst
-        if request.param == "loaded":
-            partname = PackURI("/word/media/image1.png")
-            content_type = CT.PNG
-            image_part = ImagePart.load(partname, content_type, image.blob, None)
-        # case 2: image part is newly created from image file
-        elif request.param == "new":
-            image_part = ImagePart.from_image(image, None)
-
-        return image_part, expected_cx, expected_cy
-
-    @pytest.fixture(params=["loaded", "new"])
-    def filename_fixture(self, request, image_):
-        partname = PackURI("/word/media/image666.png")
-        if request.param == "loaded":
-            image_part = ImagePart(partname, None, None, None)
-            expected_filename = "image.png"
-        elif request.param == "new":
-            image_.filename = "foobar.PXG"
-            image_part = ImagePart(partname, None, None, image_)
-            expected_filename = image_.filename
-        return image_part, expected_filename
-
-    @pytest.fixture
-    def image_(self, request):
-        return instance_mock(request, Image)
-
-    @pytest.fixture
-    def _init_(self, request):
-        return initializer_mock(request, ImagePart)
-
-    @pytest.fixture
-    def image_part_(self, request):
-        return instance_mock(request, ImagePart)
-
-    @pytest.fixture
-    def image_part_load_(self, request):
-        return method_mock(request, ImagePart, "load", autospec=False)
-
-    @pytest.fixture
-    def package_(self, request):
-        return instance_mock(request, Package)
-
-    @pytest.fixture
-    def partname_(self, request):
-        return instance_mock(request, PackURI)
