ComponentReferenceTest

class ip_manager.testing.ComponentReferenceTest

Test LayoutView, NetlistView and CircuitModelView of a component against known-good reference files.

Pytest test class which integrates multiple tests into one.

  • The tests to be run can be selected by marking the class with the comparisons mark (see example below).

  • Known-good reference files can be regenerated after a known change by running pytest --regenerate.

  • Configuration of each test is done through pytest fixtures.

Compare.LayoutToGds:

Compares the in-memory layout to a layout imported from a GDSII file, without GDSII filters applied. Also writes a temporary GDSII file with the in-memory layout for easy comparison.

Compare.GdsToGds:

Writes the in-memory layout to a temporary GDSII file and reads it back in. Then, compares it with a layout imported from a GDSII file with GDSII filters applied.

Compare.LayoutToXML:

Exports an XML of the Layout (with ports, with TECH.GDSII.FILTER applied). Compares the exported XML to a reference XML.

Compare.LayoutDrawingToXML:

Exports an XML of the Layout (layout drawing data only, no port information) without TECH.GDSII.FILTER applied. Compares the exported XML to a reference XML.

Compare.NetlistToXML:

Exports an XML of the Netlist and compares to a reference XML.

Compare.SMatrix:

Compares the in-memory s-matrix of the CircuitModelView to a reference smatrix for the specified wavelengths. Also, writes the in-memory s-matrix to a temporary file.

Examples

# Example of how to select 3 tests on a ComponentReferenceTest

from ip_manager.testing import ComponentReferenceTest, Compare
import pytest

@pytest.mark.comparisons([Compare.LayoutToGds, Compare.NetlistToXML, Compare.SMatrix])
class TestMyComponent(ComponentReferenceTest):
    @pytest.fixture
    def wavelengths(self):
        return np.arange(1.25, 1.351, 0.01)

    @pytest.fixture
    def component(self):
        return MyComponent(name="my_component")
class Config
xor_equivalence = True
similarity_tolerance = 0.02
ref_time = datetime.datetime(2014, 6, 10, 10, 10, 10, tzinfo=datetime.timezone.utc)
abstract component()

Fixture returning the component (i3.PCell object) to be tested.

Needs to be implemented by the user.