@@ -13,34 +13,20 @@ def test_dump_ds(self):
1313 with xr .set_options (display_width = 80 ):
1414 result = self .invoke_cli (["dump" , TEST_NC_FILE ])
1515
16- # Use a regex to accommodate the differing output formats produced by
17- # various xarray versions.
18- output_regex = r"""<xarray.Dataset>( Size: 8MB)?
19- Dimensions:\s+\((?=.*lon: 360)(?=.*lat: 180)(?=.*time: 5)(?=.*bnds: 2).*?\)
20- Coordinates:
21- \* lon \(lon\) float64 (3kB )?-179\.5 -178\.5 -177\.5 \.\.\. 177\.5 178\.5 179\.5
22- \* lat \(lat\) float64 (1kB )?-89\.5 -88\.5 -87\.5 -86\.5 \.\.\. (86\.5 )?87\.5 88\.5 89\.5
23- \* time \(time\) datetime64\[ns\] (40B )?2010-01-01T12:00:00 \.\.\. 2010-01-(05T1)?\.\.\.
24- lon_bnds \(lon, bnds\) float64 (6kB )?\.\.\.
25- lat_bnds \(lat, bnds\) float64 (3kB )?\.\.\.
26- time_bnds \(time, bnds\) datetime64\[ns\] (80B )?\.\.\.
27- Dimensions without coordinates: bnds
16+ self .assertIn ("<xarray.Dataset>" , result .output )
17+ self .assertIn ("Coordinates:\n " , result .output )
18+ self .assertIn (" * lon (lon) float64 " , result .output )
19+ self .assertIn ("Data variables:\n " , result .output )
20+ self .assertIn (" precipitation (time, lat, lon) float64 " , result .output )
21+ self .assertIn ("Attributes:\n " , result .output )
22+ self .assertIn ("title: Test Cube" , result .output )
23+
24+ variables_regex = r"""
2825Data variables:
29- precipitation \(time, lat, lon\) float64 (3MB )?...
30- temperature \(time, lat, lon\) float64 (3MB )?...
31- soil_moisture \(time, lat, lon\) float64 (3MB )?...
32- Attributes:
33- Conventions: CF-1.7
34- title: Test Cube
35- time_coverage_start: 2010-01-01T00:00:00.000000000
36- time_coverage_end: 2010-01-06T00:00:00.000000000
37- geospatial_lon_min: -180.0
38- geospatial_lon_max: 180.0
39- geospatial_lon_units: degrees_east
40- geospatial_lat_min: -90.0
41- geospatial_lat_max: 90.0
42- geospatial_lat_units: degrees_north
26+ precipitation \(time, lat, lon\) float64 (3MB)? ...
27+ temperature \(time, lat, lon\) float64 (3MB)? ...
28+ soil_moisture \(time, lat, lon\) float64 (3MB)? ...
4329"""
4430
45- self .assertRegex (result .output , output_regex )
31+ self .assertRegex (result .output , variables_regex )
4632 self .assertEqual (0 , result .exit_code )
0 commit comments