Skip to content

Add tests to interact with Python bindings via numpy array - #95

Merged
traversaro merged 2 commits into
mainfrom
fixnumpy
Dec 3, 2026
Merged

traversaro merged 2 commits into
mainfrom
fixnumpy

Conversation

@traversaro

Copy link
Copy Markdown
Contributor

This was the second comment that I had on #88 . My feeling is that most user of dinrail would find it natural to interact with dinrail via numpy array.

So I tested this with a few tests. For "setting" the value, both list and np.array work fine. For reading the value, the output needs to be converted every time with np.asarray. I wonder if it make instead sense to give in output directly np.array, and users that need list can convert them after the call?

@traversaro

Copy link
Copy Markdown
Contributor Author

@S-Dafarra thanks for the review, but I wanted to know your opinion on:

So I tested this with a few tests. For "setting" the value, both list and np.array work fine. For reading the value, the output needs to be converted every time with np.asarray. I wonder if it make instead sense to give in output directly np.array, and users that need list can convert them after the call?

(Clearly the change of that would be a bigger PR)

@S-Dafarra

Copy link
Copy Markdown
Contributor

@S-Dafarra thanks for the review, but I wanted to know your opinion on:

So I tested this with a few tests. For "setting" the value, both list and np.array work fine. For reading the value, the output needs to be converted every time with np.asarray. I wonder if it make instead sense to give in output directly np.array, and users that need list can convert them after the call?

(Clearly the change of that would be a bigger PR)

Sorry, I missed the question in the first place! I think it is a good idea. On it

@S-Dafarra

Copy link
Copy Markdown
Contributor

Corresponding PR #97

@traversaro

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	bindings/python/core/tests/test_interfaces.py

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in merge commit 51d7674. Python syntax and whitespace checks passed; runtime tests could not run because Pixi and the Python test dependencies are unavailable.

@traversaro

Copy link
Copy Markdown
Contributor Author

I do not think the agent got correctly what changed in the other PR.

@traversaro

Copy link
Copy Markdown
Contributor Author

I do not think the agent got correctly what changed in the other PR.

However, given how assert_* function works, it worked fine, so let's merge and release.

@traversaro
traversaro merged commit 75aba3c into main Dec 3, 2026
3 checks passed
@traversaro
traversaro deleted the fixnumpy branch December 3, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants