Skip to content
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

Feature/alias elements #94

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
851beb3
Added PY3.7
glow-mdsol Sep 7, 2018
07c4f5b
Use six.string_types
glow-mdsol Sep 7, 2018
e05b8f6
Corrected datatype type
glow-mdsol Sep 7, 2018
8802595
pull all the tests into one place
glow-mdsol Sep 7, 2018
90e2c0c
run code format using BLACK
glow-mdsol Sep 7, 2018
5637c52
handle deprecation on getchildren
glow-mdsol Sep 7, 2018
5393a93
centralise the tests
glow-mdsol Sep 7, 2018
73ff650
reformat using BLACK
glow-mdsol Sep 7, 2018
7fa74b9
Add Python 3.7
glow-mdsol Sep 7, 2018
c30cf1c
Bump version
glow-mdsol Sep 7, 2018
6d879d2
added httpretty as development dependency
glow-mdsol Sep 7, 2018
bfeb943
install_requires should be a list
glow-mdsol Sep 7, 2018
d0c1e6a
workaround for python 3.7
glow-mdsol Sep 7, 2018
407592a
Updated version information
glow-mdsol Sep 7, 2018
ae0ab14
Corrected DataType for datatype
glow-mdsol Sep 7, 2018
f2e2470
Removed unneeded OrderNumber Attribute from MeasurementUnitRef
glow-mdsol Sep 22, 2018
c8c1e5a
Reformat using BLACK
glow-mdsol Sep 22, 2018
d8bc06f
Support autodoc from Classes
glow-mdsol Sep 22, 2018
ba8de26
Reformatted using BLACK
glow-mdsol Sep 22, 2018
11327e7
Moved dev requirements into requirements-dev.txt
glow-mdsol Sep 22, 2018
19915ef
Added venv and tox to the gitignore
glow-mdsol Sep 22, 2018
aca4fa7
Update to match the BLACK reformatting of strings
glow-mdsol Sep 24, 2018
c901974
reformatted doc strings and allow autodoc
glow-mdsol Sep 24, 2018
c735a6a
Make OrderNumber not required (fixes Issue #92)
glow-mdsol Sep 24, 2018
b039b7f
Added note about environment setup
glow-mdsol Sep 26, 2018
7e04921
Collapse multiple ..note entries
glow-mdsol Sep 26, 2018
ad53c9b
Made the OrderNumber lazy (fixes #93)
glow-mdsol Sep 26, 2018
cfa8ba4
Use ..note::
glow-mdsol Sep 26, 2018
16c133d
Watch for innate nullity from python
glow-mdsol Sep 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rwslib/builders/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def __init__(self, oid, order_number=None, mandatory=False):
def build(self, builder):
"""Build XML by appending to builder"""
params = dict(StudyEventOID=self.oid, Mandatory=bool_to_yes_no(self.mandatory))
if self._order_number:
if self._order_number is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be a cardinal number? I don't know what Rave enforces here. Can you have an Ordinal or 0 or -1 ? ODM recommends numbers starting at 1 but not sure what Rave requires?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rave just seems to parse it as an int.....

params["OrderNumber"] = self._order_number
builder.start("StudyEventRef", params)
builder.end("StudyEventRef")
Expand Down
6 changes: 6 additions & 0 deletions rwslib/tests/test_builders_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def test_optional_order_number(self):
self.assertIsNone(doc.get('OrderNumber'))
self.assertEquals("No", doc.get('Mandatory'))

def test_zero_order_number(self):
"""Not that it's entirely sensible, but it's cleaner"""
ser = StudyEventRef("OID", order_number=0)
doc = obj_to_doc(ser)
self.assertEquals("0", str(doc.get('OrderNumber')))

def test_mandatory_study_event_ref(self):
ser = StudyEventRef("OID", mandatory=True)
doc = obj_to_doc(ser)
Expand Down