Skip to content

Add targeted coverage for ergonomics helpers and profiling edge cases#1302

Merged
SkBlaz merged 2 commits intomasterfrom
copilot/find-test-coverage-gaps
Mar 27, 2026
Merged

Add targeted coverage for ergonomics helpers and profiling edge cases#1302
SkBlaz merged 2 commits intomasterfrom
copilot/find-test-coverage-gaps

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

This PR addresses test coverage gaps in helper-layer APIs by adding focused tests for un/under-tested behavior in py3plex.ergonomics and py3plex.profiling. The changes are scoped to tests only and target correctness-sensitive control paths (dispatch, filtering/output shape, and benchmark statistics).

  • Ergonomics helper coverage (tests/test_ergonomics_helpers.py)

    • Added tests for quick_network:
      • replica/node construction across layers
      • intra-layer and inter-layer edge wiring
      • directed/undirected behavior
    • Added tests for quick_analysis:
      • returned payload contract (dataframe, count, network_stats)
    • Added tests for quick_communities:
      • invalid algorithm error path
      • algorithm dispatch for both louvain and leiden via monkeypatched mocks
    • Added test for show_network_summary:
      • verifies key summary sections/fields are emitted
  • Profiling edge-case coverage (tests/test_profiling_additional.py)

    • Added empty-monitor report assertion for PerformanceMonitor.get_report()
    • Added deterministic median-path tests for benchmark():
      • even-iteration median (average of middle two)
      • odd-iteration median (middle element)
  • Representative snippet

    mock_louvain = Mock(return_value={("A", "layer1"): 0, ("B", "layer1"): 1})
    monkeypatch.setattr(cd, "louvain_multilayer", mock_louvain)
    
    result = quick_communities(net, algorithm="louvain", seed=123)
    mock_louvain.assert_called_once_with(net, random_state=123)
    assert result["n_communities"] == 2

@SkBlaz SkBlaz marked this pull request as ready for review March 27, 2026 22:05
@SkBlaz SkBlaz self-requested a review as a code owner March 27, 2026 22:05
@SkBlaz SkBlaz merged commit be041ea into master Mar 27, 2026
33 checks passed
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.

2 participants