Skip to content

Commit b31b011

Browse files
author
Steve Canny
committed
img: add _IfdEntry.tag and .value
1 parent 57e86cb commit b31b011

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docx/image/tiff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ def tag(self):
205205
"""
206206
Short int code that identifies this IFD entry
207207
"""
208-
raise NotImplementedError
208+
return self._tag_code
209209

210210
@property
211211
def value(self):
212212
"""
213213
Value of this tag, its type being dependent on the tag.
214214
"""
215-
raise NotImplementedError
215+
return self._value
216216

217217

218218
class _AsciiIfdEntry(_IfdEntry):

tests/image/test_tiff.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ def it_can_construct_from_a_stream_and_offset(self, from_stream_fixture):
343343
_IfdEntry__init_.assert_called_once_with(tag_code, value_)
344344
assert isinstance(ifd_entry, _IfdEntry)
345345

346+
def it_provides_read_only_access_to_the_directory_entry(self):
347+
tag_code, value = 1, 2
348+
ifd_entry = _IfdEntry(tag_code, value)
349+
assert (ifd_entry.tag, ifd_entry.value) == (tag_code, value)
350+
346351
# fixtures -------------------------------------------------------
347352

348353
@pytest.fixture

0 commit comments

Comments
 (0)