Skip to content

tests: geometry (tier-1)#184

Open
jandom wants to merge 8 commits into
mainfrom
jandom/2026-04/tests-tier-1-geometry
Open

tests: geometry (tier-1)#184
jandom wants to merge 8 commits into
mainfrom
jandom/2026-04/tests-tier-1-geometry

Conversation

@jandom
Copy link
Copy Markdown
Collaborator

@jandom jandom commented Apr 16, 2026

Summary

  • Improving test coverage of the geometry package, and the mypy annotations (since it's a leaf package, isolated)

Changes

  • minimal code changes (typing annotations), and only tests added

Related Issues

Testing

Other Notes

@jandom jandom self-assigned this Apr 16, 2026
@jandom jandom requested a review from jnwei April 16, 2026 10:15
@jandom jandom added the safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. label Apr 16, 2026
@jandom jandom marked this pull request as ready for review April 30, 2026 13:42
@jandom jandom added safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. and removed safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

@jnwei jnwei left a comment

Choose a reason for hiding this comment

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

LGTM with some fixes requested for imports and a readability nit

Comment on lines +14 to +17
from .helpers import rigid as _rigid
from .helpers import rot_x as _rot_x
from .helpers import rot_z as _rot_z
from .helpers import v as _v
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prefer to use the explicit import path, rather than the relative path, e.g. openfold3.tests.utils.geometry.helpers

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

switched, i also added a ruff rule to enforce this repo-wide, so a few other files were touched

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: It would be slightly more clear if we annotated the return types that are scalars (formerly Float) to with something like

def dot(self, other: Vec3Array) -> torch.Tensor: # return: scalar

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ah, this is something I still need to add

recovered = rig.to_tensor()
assert torch.allclose(recovered, mat)

def test_from_tensor_4x4_round_trip(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since .from_tensor_4x4 and .to_tensor_4x4 is an alias of .from_tensor and .to_tensor, I think this test is redundant and could be removed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yup, good catch, thx

)


def rigid(rot: Rot3Array, tx: float, ty: float, tz: float) -> Rigid3Array:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit - It would be a lot more readable if tx, ty, and tz were passed in as a tuple, rather than as 3 separate floats.

In the helper function, these values get converted into a Vector3D anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

True true, done

# ===================================================================


class TestScalarMultiply:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Should probably include a test case for multiply by a scalar != 1 or 0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed

Comment on lines +21 to +23
from .helpers import v as _v
from .helpers import vb as _vb

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prefer direct imports rather than relative imports

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed

@jandom jandom requested a review from jnwei May 5, 2026 08:25
@jandom jandom added safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. and removed safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. labels May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants