-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add properties and methods to SR content items and templates #69
Conversation
…hology/highdicom into feat/sr-content-decoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! Some minor suggestions
@@ -377,6 +391,8 @@ def test_datetime_item_construction_from_datetime(self): | |||
assert i.ValueType == 'DATETIME' | |||
assert i.ConceptNameCodeSequence[0] == name | |||
assert i.DateTime == DT(value) | |||
assert i.name == CodedConcept(*name) | |||
assert i.value == value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely recommend running this test and any test involving the pydicom DT class with the pydicom.config.datetime_conversion
config parameter set to both True
and False
, as speaking from experience this can cause really frustrating errors if the end user changes the config value. This can be achieved nicely with a fixture, like I did in the pydicom tests here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need a bit of work. We currently use unittest.TestCase
, which is incompatible with pytest.fixture
(see docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular class wouldn't need to be subclassed from unittest.TestCase
, but we should then change this across the board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I see. Well we already have several tests that do not use unittest.TestCase
, for example those in test_valuerep
and test_utils
, so although it's a bit messy, it doesn't seem like a little more mix and match would hurt too much?
I've just been bitten too many times before by this datetime_conversion
thing and really think having the test would be a good idea...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Maybe we should just rip out unittest.TestCase
. This caused problems before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but I don't see any urgency.
I agree this is tricky. I don't think there is a perfect solution. I see a couple of problems with the proposed
Two other options I see are:
Any thoughts? Even trickier in my mind is the return type of the |
Co-authored-by: Chris Bridge <[email protected]>
…hology/highdicom into feat/sr-content-decoding
Co-authored-by: Chris Bridge <[email protected]>
@CPBridge I addressed most of your comments and included your suggestions. There are a few remaining open comments that we would need to discuss. |
Co-authored-by: Chris Bridge <[email protected]>
This has meanwhile been implemented in pydicom
Merged to dev branch via command line to continue refinement there alongside #74 |
This will allow consistent access to values of content items independent of their value type. The only exception are content items of type CONTAINER, which I would argue don't have a value.