Skip to content

Conversation

@pjreiniger
Copy link
Contributor

@pjreiniger pjreiniger commented Dec 9, 2025

Used Gemini to convert the C++ tests in wpimath/.../geometry to pytest. For ease of use required a small change to add attributes to the Quaternion binding.

I did this conversion months ago (before robotpy landed and before the reorg), so new tests might be missing. At least its better than nothing 🤷

Broke the huge pr that does almost everything into parts so its easier to review.

@pjreiniger pjreiniger requested a review from a team as a code owner December 9, 2025 06:22
@github-actions github-actions bot added component: wpimath Math library 2027 2027 target labels Dec 9, 2025
virtuald
virtuald previously approved these changes Dec 9, 2025
Copy link
Member

@virtuald virtuald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't actually review the tests in detail, but they look sane. If they pass then it's probably good enough.

Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this missing an equivalent for Rotation2dTest? (I'm not in a good position to say whether we want to block this PR on adding that in, since the PR comment does acknowledge that new tests might be missing. I will say though that it's really weird that Rotation2dTest would be missing, since that's been around for a really long time.)

@pjreiniger
Copy link
Contributor Author

pjreiniger commented Dec 9, 2025

Isn't this missing an equivalent for Rotation2dTest? (I'm not in a good position to say whether we want to block this PR on adding that in, since the PR comment does acknowledge that new tests might be missing. I will say though that it's really weird that Rotation2dTest would be missing, since that's been around for a really long time.)

Its the only test that already existed in robotpy (for the geometry subfolder). It already covers all the things the C++ tests do, so nothing needed to be added/modified.

@KangarooKoala
Copy link
Contributor

Its the only test that already existed in robotpy (for the geometry subfolder).

Ah, thanks, I missed that!

It already covers all the things the C++ tests do

Sorry if I'm missing something again, but isn't it missing an equivalent to the Multiply test?


def test_composition():
initial = Pose2d(x=1, y=2, rotation=Rotation2d.fromDegrees(45))
transform1 = Transform2d(Translation2d(x=5, y=0), rotation=Rotation2d.fromDegrees(5))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the order of the params for translations are probably obvious enough that I expect teams won't use keyword arguments to construct translations, transforms and poses. Not a big deal though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a big regex find and replace in a lot of places. I can stop mod'ing that in the future prs

auscompgeek
auscompgeek previously approved these changes Dec 20, 2025
Copy link
Member

@auscompgeek auscompgeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@auscompgeek auscompgeek added the robotpy Issues that affect RobotPy (Python) support label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2027 2027 target component: wpimath Math library robotpy Issues that affect RobotPy (Python) support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants