def setUp(self): self.cube = stock.simple_3d() self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines()) col_span = self.representer.ndims self.row = self.representer._make_row('title', body='first', col_span=col_span)
def test_handle_newline(self): cube = self.cube cube.attributes['lines'] = 'first\nsecond' representer = CubeRepresentation(cube) representer._get_bits(representer._get_lines()) result = representer._make_content() self.assertIn('first<br>second', result)
def test_no_attrs(self): self.cube.attributes = {} representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertIn('dimension coordinates', result) self.assertIn('auxiliary coordinates', result) self.assertIn('scalar coordinates', result) self.assertNotIn('attributes', result)
def test_no_dim_coords(self): dim_coords = [c.name() for c in self.cube.coords(dim_coords=True)] for coord in dim_coords: self.cube.remove_coord(coord) representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertNotIn('dimension coordinates', result) self.assertIn('auxiliary coordinates', result) self.assertIn('scalar coordinates', result) self.assertIn('attributes', result)
def test_no_aux_coords(self): aux_coords = ["forecast_period"] for coord in aux_coords: self.cube.remove_coord(coord) representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertIn("dimension coordinates", result) self.assertNotIn("auxiliary coordinates", result) self.assertIn("scalar coordinates", result) self.assertIn("attributes", result)
def test_no_coords(self): all_coords = [coord.name() for coord in self.cube.coords()] for coord in all_coords: self.cube.remove_coord(coord) representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertNotIn("dimension coordinates", result) self.assertNotIn("auxiliary coordinates", result) self.assertNotIn("scalar coordinates", result) self.assertIn("attributes", result)
def test_no_scalar_coords(self): aux_coords = ['air_pressure'] for coord in aux_coords: self.cube.remove_coord(coord) representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertIn('dimension coordinates', result) self.assertIn('auxiliary coordinates', result) self.assertNotIn('scalar coordinates', result) self.assertIn('attributes', result)
def setUp(self): self.cube = stock.realistic_4d() cmth = CellMethod("mean", "time", "6hr") self.cube.add_cell_method(cmth) cms = CellMeasure([0, 1, 2, 3, 4, 5], long_name="foo") self.cube.add_cell_measure(cms, 0) avr = AncillaryVariable([0, 1, 2, 3, 4, 5], long_name="bar") self.cube.add_ancillary_variable(avr, 0) scms = CellMeasure([0], long_name="baz") self.cube.add_cell_measure(scms) self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines())
def setUp(self): self.cube = stock.realistic_4d() cmth = CellMethod('mean', 'time', '6hr') self.cube.add_cell_method(cmth) cms = CellMeasure([0, 1, 2, 3, 4, 5], measure='area', long_name='foo') self.cube.add_cell_measure(cms, 0) avr = AncillaryVariable([0, 1, 2, 3, 4, 5], long_name='bar') self.cube.add_ancillary_variable(avr, 0) scms = CellMeasure([0], measure='area', long_name='baz') self.cube.add_cell_measure(scms) self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines())
def setUp(self): self.cube = stock.realistic_4d() self.dim_names = [c.name() for c in self.cube.coords(dim_coords=True)] self.representer = CubeRepresentation(self.cube)
def setUp(self): self.cube = stock.lat_lon_cube() # Check we're not tripped up by names containing spaces. self.cube.rename('Electron density') self.cube.units = '1e11 e/m^3' self.representer = CubeRepresentation(self.cube)
def setUp(self): self.cube = stock.simple_3d() representer = CubeRepresentation(self.cube) self.result = representer.repr_html()
def setUp(self): self.cube = stock.simple_3d() self.representer = CubeRepresentation(self.cube)
def setUp(self): self.cube = stock.simple_3d() cm = CellMethod('mean', 'time', '6hr') self.cube.add_cell_method(cm) self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines())
def setUp(self): self.cube = stock.simple_3d() self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines()) self.result = self.representer._make_content()
def setUp(self): self.cube = stock.simple_3d() self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines()) self.result = self.representer._make_shapes_row().split('\n')
def setUp(self): self.cube = stock.simple_3d() self.representer = CubeRepresentation(self.cube) self.representer._get_bits(self.representer._get_lines()) self.header_emts = self.representer._make_header().split('\n')
def test_no_cell_methods(self): representer = CubeRepresentation(self.cube) result = representer.repr_html().lower() self.assertNotIn('cell methods', result)
def setUp(self): self.cube = stock.realistic_3d()[0, 0, 0] self.representer = CubeRepresentation(self.cube) self.representer.repr_html()
def setUp(self): self.shape = (2, 3, 4) self.cube = Cube(np.arange(24).reshape(self.shape)) self.representer = CubeRepresentation(self.cube) self.representer.repr_html()