Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 24, 2025

This PR adds comprehensive test coverage for the MarkersUpdater and PersistentMarkersUpdater classes in pyorerun/model_components/model_markers.py, addressing issue #[number].

Changes Made

Created tests/test_model_markers.py with 20 test cases covering:

MarkersUpdater Class (8 tests)

  • Constructor validation and property access (nb_markers, nb_components)
  • Core marker computation functionality with single and multiple frames
  • Rerun integration methods (to_rerun(), to_component(), to_chunk())

PersistentMarkersUpdater Class (9 tests)

  • Constructor validation and all properties (nb_markers, nb_frames, marker_names)
  • Persistent marker computation with frame-based filtering
  • Frame-aware rerun integration methods with proper chunking

Utility Functions (3 tests)

  • compute_markers() function for both single and multiple marker scenarios
  • from_pyo_to_rerun() array format conversion validation

Technical Implementation

The tests handle several challenges specific to this codebase:

Dependency Management: Created an isolated test environment to avoid import issues with optional dependencies (biorbd, opensim) that aren't available in CI environments.

Array Format Validation: Properly tests the expected numpy array transformations, particularly the (nb_markers, 3) → (3, nb_markers) transpose pattern used by the compute_markers() function.

Rerun Integration: Mocks rerun.log() calls while still validating that proper rr.Points3D components are created with correct properties.

Example Test Coverage

def test_compute_markers(self):
    """Test compute_markers method."""
    q = np.array([[1.0], [2.0], [3.0]])
    markers = self.updater.compute_markers(q)
    
    # Validates shape (3, nb_markers, nb_frames)
    assert markers.shape == (3, 3, 1)
    
    # Validates correct marker positions based on callable
    expected = np.array([
        [[1.0], [2.0], [3.0]],  # x-coords for markers 1,2,3
        [[2.0], [3.0], [4.0]],  # y-coords for markers 1,2,3  
        [[3.0], [4.0], [5.0]]   # z-coords for markers 1,2,3
    ])
    np.testing.assert_array_equal(markers, expected)

All tests follow the existing repository patterns and pytest conventions, ensuring consistency with the current test suite.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Fixes #78


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


This change is Reviewable

Copilot AI changed the title [WIP] Write tests for the MarkerUpdater and PersistentMarkerUpdater Add comprehensive tests for MarkersUpdater and PersistentMarkersUpdater classes Sep 24, 2025
Copilot AI requested a review from Ipuch September 24, 2025 12:11
Copilot finished work on behalf of Ipuch September 24, 2025 12:11
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.

Write tests for the MarkerUpdater and PersistentMarkerUpdater

2 participants