def test_ones(): fields = ModelDataFields() fields.new_field_location("node", 12) fields.new_field_location("cell", 2) value_array = fields.ones("node") assert_array_equal(np.ones(12), value_array) value_array = fields.ones("cell") assert_array_equal(np.ones(2), value_array)
def test_grid_field_zeros_ones_empty(): """Test creating scalar fields with zeros, empty, and ones.""" fields = ModelDataFields() fields.new_field_location("grid", 1) with pytest.raises(ValueError): fields.zeros("grid") with pytest.raises(ValueError): fields.empty("grid") with pytest.raises(ValueError): fields.ones("grid")
def test_ones(): fields = ModelDataFields() fields.new_field_location('node', 12) fields.new_field_location('cell', 2) value_array = fields.ones('node') assert_array_equal(np.ones(12), value_array) value_array = fields.ones('cell') assert_array_equal(np.ones(2), value_array)