Repository: Unidata/siphon

Issue:
NCSS validate_query with no variables
``` python
from siphon.ncss import NCSS
ncss = NCSS('http://thredds.ucar.edu/thredds/ncss/nws/metar/ncdecoded/Metar_Station_Data_fc.cdmr')
query = ncss.query()
ncss.validate_query(query)
```

returns `set()`

Looks like the nice short-circuit behavior results in the return of the empty variable query--I think a call to `bool()` is in order.


Discussion:

Patch:
diff --git a/siphon/ncss.py b/siphon/ncss.py
index 7f1a971e..da1a11e8 100644
--- a/siphon/ncss.py
+++ b/siphon/ncss.py
@@ -88,7 +88,7 @@ class NCSS(HTTPEndPoint):
 
         """
         # Make sure all variables are in the dataset
-        return query.var and all(var in self.variables for var in query.var)
+        return bool(query.var) and all(var in self.variables for var in query.var)
 
     def get_data(self, query):
         """Fetch parsed data from a THREDDS server using NCSS.


Test patch:
diff --git a/siphon/tests/test_ncss.py b/siphon/tests/test_ncss.py
index 4cee1576..1d0b7b70 100644
--- a/siphon/tests/test_ncss.py
+++ b/siphon/tests/test_ncss.py
@@ -92,6 +92,13 @@ class TestNCSS(object):
         self.nq.variables('foo')
         assert not self.ncss.validate_query(self.nq)
 
+    def test_empty_query(self):
+        """Test that an empty query is invalid."""
+        query = self.ncss.query()
+        res = self.ncss.validate_query(query)
+        assert not res
+        assert not isinstance(res, set)
+
     def test_bad_query_no_vars(self):
         """Test that a query without variables is invalid."""
         self.nq.var.clear()