Skip to content

Commit d1a2657

Browse files
authored
Use builtin ValueError
1 parent 512f48b commit d1a2657

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/ansys/dpf/core/field_definition.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
from __future__ import annotations
2626

27-
from argparse import ArgumentError
2827
import traceback
2928
import warnings
3029

@@ -245,7 +244,7 @@ def unit(self, value: str | tuple[Homogeneity, str]):
245244
elif isinstance(value, str):
246245
self._api.csfield_definition_set_unit(self, value, None, 0, 0, 0)
247246
else:
248-
raise ArgumentError(
247+
raise ValueError(
249248
None, message="Unit setter supports either string or tuple(Homogeneity, str)"
250249
)
251250

tests/test_field.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
from argparse import ArgumentError
2423
import copy
2524
import gc
2625

@@ -1447,5 +1446,5 @@ def test_set_units(server_type):
14471446
field.unit = "sones"
14481447

14491448
# use wrong type of arguments
1450-
with pytest.raises(ArgumentError):
1449+
with pytest.raises(ValueError):
14511450
field.unit = 1.0

0 commit comments

Comments
 (0)