Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CLIMATE-768 - Fix failing tests in test_dap.py. Add extra logic to da…
…p.py to check for named dimensions.
  • Loading branch information
MichaelArthurAnderson committed Feb 26, 2016
1 parent 4c4ff7c commit de190c6d7c562c87eadf2ce2645fa744f379f4bf
Showing 1 changed file with 11 additions and 9 deletions.
@@ -16,31 +16,33 @@
# under the License.

import unittest
import datetime as dt
import ocw.data_source.dap as dap
from ocw.dataset import Dataset
import datetime as dt


class TestDap(unittest.TestCase):
@classmethod
def setup_class(self):
self.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/CG2006158_120000h_usfc.nc'
self.name = 'foo'
self.dataset = dap.load(self.url, 'CGusfc', name=self.name)
def setUpClass(cls):

cls.url = 'http://test.opendap.org/opendap/data/ncml/agg/dated/CG2006158_120000h_usfc.nc'
cls.name = 'foo'
cls.dataset = dap.load(cls.url, 'CGusfc', name=cls.name)

def test_dataset_is_returned(self):
self.assertTrue(isinstance(self.dataset, Dataset))

def test_correct_lat_shape(self):
self.assertEquals(len(self.dataset.lats), 89)
self.assertEquals(len(self.dataset.lats), 29)

def test_correct_lon_shape(self):
self.assertEquals(len(self.dataset.lons), 180)
self.assertEquals(len(self.dataset.lons), 26)

def test_correct_time_shape(self):
self.assertEquals(len(self.dataset.times), 1857)
self.assertEquals(len(self.dataset.times), 1)

def test_valid_date_conversion(self):
start = dt.datetime(1854, 1, 1)
start = dt.datetime(2006, 6, 7, 12)
self.assertTrue(start == self.dataset.times[0])

def test_custom_dataset_name(self):

0 comments on commit de190c6

Please sign in to comment.