Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove test warnings #2455

Merged
merged 1 commit into from Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 19 additions & 11 deletions tests/test_partial_function.py
Expand Up @@ -5,23 +5,31 @@
import gdsfactory as gf


@gf.cell
def mmi_with_bend(
mmi=gf.components.mmi1x2, bend=gf.components.bend_circular
) -> gf.Component:
c = gf.Component()
mmi = c << mmi()
bend = c << bend()
bend.connect("o2", mmi.ports["o2"])
return c


def test_partial_function_with_kwargs() -> None:
mmi400 = partial(gf.components.mmi1x2, width=0.4)
mmi400_args = partial(gf.components.mmi1x2, 0.4)
mmi600 = partial(gf.components.mmi1x2, width=0.6)
mzi400 = partial(gf.components.mzi, splitter=mmi400)
mzi600 = partial(gf.components.mzi, splitter=mmi600)

c400 = mzi400()
c600 = mzi600()
b400 = partial(gf.components.bend_circular, width=0.4)
b600 = partial(gf.components.bend_circular, width=0.6)

assert c600.name != c400.name, f"{c600.name} must be different from {c400.name}"
mmi_bend400 = partial(mmi_with_bend, mmi=mmi400, bend=b400)
mmi_bend600 = partial(mmi_with_bend, mmi=mmi600, bend=b600)

cmmi400 = mmi400()
cmmi400_args = mmi400_args()
assert (
cmmi400_args.name == cmmi400.name
), f"{cmmi400_args.name} must be equal to {cmmi400.name}"
c400 = mmi_bend400()
c600 = mmi_bend600()

assert c600.name != c400.name, f"{c600.name} must be different from {c400.name}"


def test_partial_function_without_kwargs() -> None:
Expand Down