File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1515def test_field_init_param_types ():
1616 data = datasets_structured ["ds_2d_left" ]
1717 grid = XGrid .from_dataset (data )
18- with pytest .raises (ValueError , match = "Expected `name` to be a string" ):
19- Field (name = 123 , data = data ["data_g" ], grid = grid )
18+
19+ with pytest .raises (TypeError , match = "Expected a string for variable name, got int instead." ):
20+ Field (name = 123 , data = data ['data_g' ], grid = grid )
21+
22+ for name in ["a b" , "123" , "while" ]:
23+ with pytest .raises (ValueError , match = r"Received invalid Python variable name.*" ):
24+ Field (name = name , data = data ['data_g' ], grid = grid )
2025
2126 with pytest .raises (ValueError , match = "Expected `data` to be a uxarray.UxDataArray or xarray.DataArray" ):
2227 Field (name = "test" , data = 123 , grid = grid )
You can’t perform that action at this time.
0 commit comments