ansys / ansys/pyfluent

Require Pythonic error message for wrong data type

Open
#1,003 8 comments 0 reactions 1 assignee Claimed by @prmukherj View on GitHub
enhancement settings-api
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

E.g.,
```
>>> s.solution.report_definitions.surface["r1"](report_type="surface-areaavg",field="pressure",average_over=1, per_surface=False,surface_names="wall")

Error: CAR: invalid argument [1]: wrong type [not a pair]
Error Object: "wall"
```

Requires e.g., a `TypeError` such as
```
TypeError: surface_names must be a str list, not a str
```

Next I change the value of the bool per_surface to an integer, and this is accepted and reflected in the new state:

```
>>> s.solution.report_definitions.surface["r1"](report_type="surface-areaavg",field="pressure",average_over=1, per_surface=1,surface_names=["wall"])
>>> s.solution.report_definitions.surface["r1"]()
{'report_type': 'surface-areaavg', 'field': 'pressure', 'average_over': 1, 'per_surface': 1, 'surface_names': ['wall']}
```

I change the integer, average_over, to a boolean and this causes another low-level error:

```
>>> s.solution.report_definitions.surface["r1"](report_type="surface-areaavg",field="pressure",average_over=True, per_surface=False,surface_names=["wall"])
Error: < (less-than): invalid argument [2]: wrong type [not a number]
Error Object: #t
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.