Skip to content

Commit

Permalink
Merge pull request #124 from lesserwhirls/validate
Browse files Browse the repository at this point in the history
Fix validation warning in tests
  • Loading branch information
dopplershift authored Mar 22, 2017
2 parents 152ac7d + 33a16f6 commit 0c660b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions siphon/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

log = logging.getLogger(__name__)
log.setLevel(logging.ERROR)
log.addHandler(logging.StreamHandler())


class _SimpleTypes(object):
Expand Down
2 changes: 1 addition & 1 deletion siphon/tests/fixtures/cat_non_standard_context_path
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interactions:
\ serviceType=\"HTTPServer\" base=\"/ereefs/tds/fileServer/\" />\r\n </service>\r\
\n <dataset name=\"P1A\" ID=\"mwq/P1A\">\r\n <metadata inherited=\"true\"\
>\r\n <serviceName>nongrid</serviceName>\r\n <authority>au.gov.bom</authority>\r\
\n <dataType>GRID</dataType>\r\n <dataFormat>netCDF</dataFormat>\r\
\n <dataType>GRID</dataType>\r\n <dataFormat>NetCDF</dataFormat>\r\
\n <documentation type=\"rights\">Registered research users only</documentation>\r\
\n </metadata>\r\n <dataset name=\"A20020101.P1A.ANN_MIM_RMP.nc\" ID=\"\
mwq/P1A/A20020101.P1A.ANN_MIM_RMP.nc\" urlPath=\"ereef/mwq/P1A/A20020101.P1A.ANN_MIM_RMP.nc\"\
Expand Down
14 changes: 9 additions & 5 deletions siphon/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

log = logging.getLogger('siphon.metadata')
log.setLevel(logging.WARNING)
log.addHandler(logging.StreamHandler())

#
# tested:
Expand Down Expand Up @@ -105,9 +104,7 @@ def test_spatial_range_valid(self):
'size': 20.6,
'units': 'degrees_north'}
element = ET.fromstring(xml)
actual = {}
for child in element:
actual.update(self.st.handle_spatialRange(element))
actual = self.st.handle_spatialRange(element)

assert actual == expected

Expand Down Expand Up @@ -346,7 +343,8 @@ def test_geospatial_coverage_attr2(self):

class TestMetadata(object):

def _make_element(self, xml_str):
@staticmethod
def _make_element(xml_str):
return ET.fromstring(xml_str)

def test_documentation_element_no_type(self):
Expand Down Expand Up @@ -498,6 +496,12 @@ def test_data_format(self):
assert 'dataFormat' in md
assert md['dataFormat'] == 'GRIB-1'

def test_data_malformed_format(self, capfd):
xml = '<dataFormat>netCDF-4</dataFormat>'
element = self._make_element(xml)
TDSCatalogMetadata(element)
assert 'Value netCDF-4 not valid for type dataFormat' in ''.join(capfd.readouterr())

def test_data_type(self):
xml = '<dataType>GRID</dataType>'
element = self._make_element(xml)
Expand Down

0 comments on commit 0c660b0

Please sign in to comment.