Skip to content

Commit

Permalink
test #77 done
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenb-dev committed Oct 28, 2024
1 parent b5f6c63 commit 076f95f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
17 changes: 12 additions & 5 deletions src/pyedb/grpc/edb_core/padstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def get_pinlist_from_component_and_net(self, refdes=None, netname=None):
)
return self.get_pin_from_component_and_net(refdes=refdes, netname=netname)

def get_pad_parameters(self, pin, layername, pad_type=0):
def get_pad_parameters(self, pin, layername, pad_type="regular_pad"):
"""Get Padstack Parameters from Pin or Padstack Definition.
Parameters
Expand All @@ -578,16 +578,23 @@ def get_pad_parameters(self, pin, layername, pad_type=0):
Pin or PadstackDef on which get values.
layername : str
Layer on which get properties.
pad_type : int
Pad Type.
pad_type : str
Pad Type, `"pad"`, `"anti_pad"`, `"thermal_pad"`
Returns
-------
tuple
Tuple of (GeometryType, ParameterList, OffsetX, OffsetY, Rot).
"""

padparams = pin.padstack_def.data.get_pad_parameters(layername, self.int_to_pad_type(pad_type))
if pad_type == "regular_pad":
pad_type = GrpcPadType.REGULAR_PAD
elif pad_type == "anti_pad":
pad_type = GrpcPadType.ANTI_PAD
elif pad_type == "thermal_pad":
pad_type = GrpcPadType.THERMAL_PAD
else:
pad_type = pad_type = GrpcPadType.REGULAR_PAD
padparams = pin.padstack_def.data.get_pad_parameters(layername, pad_type)
if len(padparams) == 5: # non polygon via
geometry_type = padparams[0]
parameters = [i.value for i in padparams[1]]
Expand Down
18 changes: 9 additions & 9 deletions tests/grpc/system/test_edb_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import pytest

from pyedb.dotnet.edb import Edb
from pyedb.grpc.edb import EdbGrpc as Edb
from tests.conftest import desktop_version, local_path
from tests.legacy.system.conftest import test_subfolder

Expand All @@ -35,21 +35,21 @@

class TestClass:
@pytest.fixture(autouse=True)
def init(self, legacy_edb_app, local_scratch, target_path, target_path3, target_path4):
self.edbapp = legacy_edb_app
def init(self, local_scratch, target_path, target_path3, target_path4):
self.local_scratch = local_scratch
self.target_path = target_path
self.target_path3 = target_path3
self.target_path4 = target_path4

def test_get_pad_parameters(self):
def test_get_pad_parameters(self, edb_examples):
"""Access to pad parameters."""
pin = self.edbapp.components.get_pin_from_component("J1", pinName="1")
parameters = self.edbapp.padstacks.get_pad_parameters(
pin[0], "1_Top", self.edbapp.padstacks.pad_type.RegularPad
)
# Done
edbapp = edb_examples.get_si_verse()
pin = edbapp.components.get_pin_from_component("J1", pin_name="1")
parameters = edbapp.padstacks.get_pad_parameters(pin=pin[0], layername="1_Top", pad_type="regular_pad")
assert isinstance(parameters[1], list)
assert isinstance(parameters[0], int)
assert isinstance(parameters[0], str)
edbapp.close()

def test_get_vias_from_nets(self):
"""Use padstacks' get_via_instance_from_net method."""
Expand Down

0 comments on commit 076f95f

Please sign in to comment.