Primitive.find_by_id fails attempting to validate the type of returned object
- Dominant language
- Python
- Stars
- 7
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/ansys/pyedb-core/blob/0772bc46d2d9ce12421e36c86d2ce37ed3a5e3e1/src/ansys/edb/core/inner/conn_obj.py#L25
The `ansys.edb.core.primitive.primitive` module does not contain the concrete primitive classes `Circle`, etc. so the above checks are failing with an `AttributeError`:
```
tests\e2e\integration_tests\test_primitive.py:9:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src\ansys\edb\core\inner\conn_obj.py:95: in find_by_id
return cls._validate_edb_obj_type(found_edb_obj_msg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src\ansys\edb\core\inner\conn_obj.py:40: in _validate_edb_obj_type
if get_client_prim_type_from_class() == primitive.Primitive(edb_obj_msg).primitive_type:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def get_client_prim_type_from_class():
> if cls == primitive.Circle:
^^^^^^^^^^^^^^^^
E AttributeError: module 'ansys.edb.core.primitive.primitive' has no attribute 'Circle'
src\ansys\edb\core\inner\conn_obj.py:25: AttributeError
```
Contributor guide
Research direction
Start with src/ansys/edb/core/inner/conn_obj.py, especially the type-validation logic around lines 25 and 40, and inspect the available classes in ansys.edb.core.primitive.primitive. Run tests\e2e\integration_tests\test_primitive.py to reproduce the AttributeError; done means Primitive.find_by_id validates the returned object without that error and the integration test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100