Skip to content

test: check all ports have manhattan orientations - #332

Merged
joamatab merged 1 commit into
gdsfactory:mainfrom
jackgdsf:test-manhattan-port-orientations
Aug 12, 2026
Merged

test: check all ports have manhattan orientations#332
joamatab merged 1 commit into
gdsfactory:mainfrom
jackgdsf:test-manhattan-port-orientations

Conversation

@jackgdsf

@jackgdsf jackgdsf commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #331

Adds test_port_orientations_manhattan to all eight band test files (ge_on_si, si220 cband, si220 oband, si340, si500, si_sus, sin200, sin300). The test is parametrized over every PDK cell already covered by the band's cell_names, builds each cell, skips gf.ComponentAllAngle components, and asserts that every remaining port's orientation is 0, 90, 180 or 270 degrees (mod 360, atol=1e-3). A per-file skip_test_manhattan_ports set is provided (empty) so known issues can be quarantined explicitly rather than by weakening the check.

This is a templated rollout of the same test we are adding across our PDKs; the reference change was reviewed and approved by @joamatab.

⚠️ AI-created PR: a human must review the actual code changes before merge.

Test plan

  • CI passes (test_port_orientations_manhattan green across all eight bands)

Summary by Sourcery

Add regression tests to ensure all non-all-angle PDK cell ports use manhattan orientations across all bands.

Tests:

  • Add parametrized manhattan-orientation port test to ge_on_si, si220 cband/oband, si340, si500, si_sus, sin200, and sin300 band test suites.
  • Introduce per-file skip list hooks to selectively disable the manhattan port orientation test for specific components if needed.

Adds test_port_orientations_manhattan, parametrized over every PDK cell.
All-angle components are skipped, and skip_test_manhattan_ports is
available for known issues.

Refs gdsfactory#331

Co-Authored-By: Claude <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a parametrized Manhattan-orientation port test to each band test module, ensuring all non-all-angle components’ ports are constrained to 0/90/180/270 degrees with an escape hatch for explicitly quarantined cells.

File-Level Changes

Change Details Files
Add a parametrized test enforcing Manhattan port orientations across all band test suites, with explicit skips for all-angle components and a per-file quarantine set.
  • Introduce MANHATTAN_ORIENTATIONS constant tuple (0, 90, 180, 270) in each band test module.
  • Add an empty skip_test_manhattan_ports set per file to allow explicit opt-out of problematic components without weakening assertions.
  • Define test_port_orientations_manhattan parametrized over existing cell_names, instantiating cells from the shared cells mapping.
  • Skip tests for components that are instances of gf.ComponentAllAngle, treating them as intentionally non-Manhattan.
  • For each remaining component port, normalize orientation modulo 360 and assert it is within atol=1e-3 of one of the Manhattan angles, raising AssertionError with a descriptive message otherwise.
tests/test_ge_on_si.py
tests/test_si220_cband.py
tests/test_si220_oband.py
tests/test_si340.py
tests/test_si500.py
tests/test_si_sus.py
tests/test_sin200.py
tests/test_sin300.py

Assessment against linked issues

Issue Objective Addressed Explanation
#331 Add a test test_port_orientations_manhattan that, for each PDK cell, builds the component, skips gf.ComponentAllAngle components, and asserts that all port orientations are 0, 90, 180, or 270 degrees (mod 360, with a small tolerance).
#331 Ensure the test_port_orientations_manhattan test is added to and parametrized over every PDK band test file (ge_on_si, si220 cband, si220 oband, si340, si500, si_sus, sin200, sin300) using their existing cell_names.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The MANHATTAN_ORIENTATIONS constant, skip_test_manhattan_ports set, and test_port_orientations_manhattan logic are duplicated in every band test file; consider extracting this into a shared helper or pytest fixture to keep the checks consistent and reduce maintenance overhead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `MANHATTAN_ORIENTATIONS` constant, `skip_test_manhattan_ports` set, and `test_port_orientations_manhattan` logic are duplicated in every band test file; consider extracting this into a shared helper or pytest fixture to keep the checks consistent and reduce maintenance overhead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joamatab
joamatab merged commit 0621876 into gdsfactory:main Aug 12, 2026
12 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.

Add test that all ports have manhattan orientations (0/90/180/270)

2 participants