From 1286544d9c7ae5a7effc16c5edf74148c17e4828 Mon Sep 17 00:00:00 2001 From: Tom Donaldson Date: Tue, 17 Dec 2019 10:07:11 -0500 Subject: [PATCH] Add default for UWS version - Issue #198 Add changelog Correct PR # in changelog Fix flake8 errors Style changes from review --- CHANGES.rst | 2 ++ pyvo/io/uws/endpoint.py | 3 ++- pyvo/io/uws/tests/data/job-implicit-v1.0.xml | 22 ++++++++++++++++++++ pyvo/io/uws/tests/test_job.py | 6 ++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 pyvo/io/uws/tests/data/job-implicit-v1.0.xml diff --git a/CHANGES.rst b/CHANGES.rst index 98d902c9c..54eb7cd44 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ 1.1 (unreleased) ================ +- Add default for UWS version. [#199] + 1.0 (2019-09-20) ================ diff --git a/pyvo/io/uws/endpoint.py b/pyvo/io/uws/endpoint.py index 30ad0b780..5d2067f17 100644 --- a/pyvo/io/uws/endpoint.py +++ b/pyvo/io/uws/endpoint.py @@ -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) diff --git a/pyvo/io/uws/tests/data/job-implicit-v1.0.xml b/pyvo/io/uws/tests/data/job-implicit-v1.0.xml new file mode 100644 index 000000000..3f886cd78 --- /dev/null +++ b/pyvo/io/uws/tests/data/job-implicit-v1.0.xml @@ -0,0 +1,22 @@ + + + 1576511540079_32840 + + COMPLETED + 2019-12-16T10:52:20 + 2019-12-17T10:52:20 + 600 + 2019-12-17T10:52:20 + + ADQL-2.0 + tap + doQuery + +SELECT ra, dec FROM table + + + + + + diff --git a/pyvo/io/uws/tests/test_job.py b/pyvo/io/uws/tests/test_job.py index 31681887e..257110171 100644 --- a/pyvo/io/uws/tests/test_job.py +++ b/pyvo/io/uws/tests/test_job.py @@ -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'