Skip to content

Commit

Permalink
Add default for UWS version - Issue #198
Browse files Browse the repository at this point in the history
Add changelog

Correct PR # in changelog

Fix flake8 errors

Style changes from review
  • Loading branch information
tomdonaldson committed Dec 17, 2019
1 parent 78e3d52 commit 1286544
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.1 (unreleased)
================

- Add default for UWS version. [#199]


1.0 (2019-09-20)
================
Expand Down
3 changes: 2 additions & 1 deletion pyvo/io/uws/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def parse(self, iterator, config):
if start and tag == 'xml':
pass
elif start and tag == 'job':
self._version = data.get('version')
# version was not required in v1.0, so default to that.
self._version = data.get('version', '1.0')
break

return super().parse(iterator, config)
Expand Down
22 changes: 22 additions & 0 deletions pyvo/io/uws/tests/data/job-implicit-v1.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" ?>
<job xmlns="http://www.ivoa.net/xml/UWS/v1.0" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/UWS/v1.0 http://www.ivoa.net/xml/UWS/v1.0">
<jobId>1576511540079_32840</jobId>
<ownerId/>
<phase>COMPLETED</phase>
<startTime>2019-12-16T10:52:20</startTime>
<endTime>2019-12-17T10:52:20</endTime>
<executionDuration>600</executionDuration>
<destruction>2019-12-17T10:52:20</destruction>
<parameters>
<parameter id="lang">ADQL-2.0</parameter>
<parameter id="serviceType">tap</parameter>
<parameter id="request">doQuery</parameter>
<parameter id="query">
SELECT ra, dec FROM table
</parameter>
</parameters>
<results>
<result id="resultsTable" xlink:href="http://example.com/tap/async/1234/results/result"/>
</results>
</job>
6 changes: 6 additions & 0 deletions pyvo/io/uws/tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ def test_job(self):
"data/job.xml"))

assert job.jobid == '1337'
assert job.version == '1.1'

job = uws.parse_job(get_pkg_data_filename(
"data/job-implicit-v1.0.xml"))

assert job.version == '1.0'

0 comments on commit 1286544

Please sign in to comment.