コード例 #1
0
ファイル: test_jpeg.py プロジェクト: missnataliewood/docx
 def it_can_construct_from_non_Exif_APP1_segment(self, non_Exif_fixture):
     stream, marker_code, offset = non_Exif_fixture[:3]
     _App1Marker__init_, length = non_Exif_fixture[3:]
     app1_marker = _App1Marker.from_stream(stream, marker_code, offset)
     _App1Marker__init_.assert_called_once_with(marker_code, offset, length,
                                                72, 72)
     assert isinstance(app1_marker, _App1Marker)
コード例 #2
0
ファイル: test_jpeg.py プロジェクト: anantshri/python-docx
 def it_can_construct_from_non_Exif_APP1_segment(self, non_Exif_fixture):
     stream, marker_code, offset = non_Exif_fixture[:3]
     _App1Marker__init_, length = non_Exif_fixture[3:]
     app1_marker = _App1Marker.from_stream(stream, marker_code, offset)
     _App1Marker__init_.assert_called_once_with(
         marker_code, offset, length, 72, 72
     )
     assert isinstance(app1_marker, _App1Marker)
コード例 #3
0
ファイル: test_jpeg.py プロジェクト: missnataliewood/docx
 def it_can_construct_from_a_stream_and_offset(self, from_stream_fixture):
     (stream, marker_code, offset, _App1Marker__init_, length,
      _tiff_from_exif_segment_, horz_dpi, vert_dpi) = from_stream_fixture
     app1_marker = _App1Marker.from_stream(stream, marker_code, offset)
     _tiff_from_exif_segment_.assert_called_once_with(
         stream, offset, length)
     _App1Marker__init_.assert_called_once_with(marker_code, offset, length,
                                                horz_dpi, vert_dpi)
     assert isinstance(app1_marker, _App1Marker)
コード例 #4
0
    def it_can_construct_from_non_Exif_APP1_segment(self, _App1Marker__init_):
        bytes_ = b'\x00\x42Foobar'
        marker_code, offset, length = JPEG_MARKER_CODE.APP1, 0, 66
        stream = StreamReader(BytesIO(bytes_), BIG_ENDIAN)

        app1_marker = _App1Marker.from_stream(stream, marker_code, offset)

        _App1Marker__init_.assert_called_once_with(ANY, marker_code, offset,
                                                   length, 72, 72)
        assert isinstance(app1_marker, _App1Marker)
コード例 #5
0
ファイル: test_jpeg.py プロジェクト: anantshri/python-docx
 def it_can_construct_from_a_stream_and_offset(self, from_stream_fixture):
     (stream, marker_code, offset, _App1Marker__init_, length,
      _tiff_from_exif_segment_, horz_dpi, vert_dpi) = from_stream_fixture
     app1_marker = _App1Marker.from_stream(stream, marker_code, offset)
     _tiff_from_exif_segment_.assert_called_once_with(
         stream, offset, length
     )
     _App1Marker__init_.assert_called_once_with(
         marker_code, offset, length, horz_dpi, vert_dpi
     )
     assert isinstance(app1_marker, _App1Marker)
コード例 #6
0
ファイル: test_jpeg.py プロジェクト: madphysicist/python-docx
    def it_can_construct_from_non_Exif_APP1_segment(self, _App1Marker__init_):
        bytes_ = b'\x00\x42Foobar'
        marker_code, offset, length = JPEG_MARKER_CODE.APP1, 0, 66
        stream = StreamReader(BytesIO(bytes_), BIG_ENDIAN)

        app1_marker = _App1Marker.from_stream(stream, marker_code, offset)

        _App1Marker__init_.assert_called_once_with(
            ANY, marker_code, offset, length, 72, 72
        )
        assert isinstance(app1_marker, _App1Marker)
コード例 #7
0
    def it_can_construct_from_a_stream_and_offset(self, _App1Marker__init_,
                                                  _tiff_from_exif_segment_):
        bytes_ = b'\x00\x42Exif\x00\x00'
        marker_code, offset, length = JPEG_MARKER_CODE.APP1, 0, 66
        horz_dpi, vert_dpi = 42, 24
        stream = StreamReader(BytesIO(bytes_), BIG_ENDIAN)

        app1_marker = _App1Marker.from_stream(stream, marker_code, offset)

        _tiff_from_exif_segment_.assert_called_once_with(
            stream, offset, length)
        _App1Marker__init_.assert_called_once_with(ANY, marker_code, offset,
                                                   length, horz_dpi, vert_dpi)
        assert isinstance(app1_marker, _App1Marker)
コード例 #8
0
ファイル: test_jpeg.py プロジェクト: madphysicist/python-docx
    def it_can_construct_from_a_stream_and_offset(
        self, _App1Marker__init_, _tiff_from_exif_segment_
    ):
        bytes_ = b'\x00\x42Exif\x00\x00'
        marker_code, offset, length = JPEG_MARKER_CODE.APP1, 0, 66
        horz_dpi, vert_dpi = 42, 24
        stream = StreamReader(BytesIO(bytes_), BIG_ENDIAN)

        app1_marker = _App1Marker.from_stream(stream, marker_code, offset)

        _tiff_from_exif_segment_.assert_called_once_with(stream, offset, length)
        _App1Marker__init_.assert_called_once_with(
            ANY, marker_code, offset, length, horz_dpi, vert_dpi
        )
        assert isinstance(app1_marker, _App1Marker)