Conversation
…ion of notImplementedErrors
Trying to exclude abstract methods and not implemented cases from the coverage reports
…d some dataclass implementation to use __post_init__
…ytrnsys_gui into RefactorConnectionBase
|
Kudos, SonarCloud Quality Gate passed!
|
| return _tp.cast(_dpc.DoublePipeConnection, mock) | ||
|
|
||
|
|
||
| def createSimpleSPConnectionMock( |
There was a problem hiding this comment.
@ahobeost: make testStorage use this mock and the dp version as well
|
|
||
|
|
||
| class FakeSegmentItem(_fc.StrictMockBase): | ||
| def __init__(self, startNode, endNode, connection, **kwargs): |
| yEndCoordsExpected=[15.666, 15.666, 100.0], | ||
| ) | ||
|
|
||
| def _runNiceConnWithTests( # pylint: disable = too-many-arguments, too-many-locals |
There was a problem hiding this comment.
helper class would fix the too-many-locals issue
| patchString="NiceConnectorBothZero", | ||
| connectorType=_gnc.NiceConnectorBothZero, | ||
| addItemCount=1, | ||
| fromPortSide=0, |
There was a problem hiding this comment.
use clear variables for the port sides, here:
left=0, right=1, top=2, bottom=3 <- may not be correct!
with enums!
There was a problem hiding this comment.
Then, the tests could be called "bothLeft" etc.
| fullPatchString = "trnsysGUI.connection.getNiceConnector." + patchString + "._addGraphicsItems" | ||
| with _m.patch(fullPatchString, return_value=None) as mockMethod: | ||
| if patchString == "NiceConnectorFromAbove": | ||
| connectorType(dpConnection, segmentItemFactory, rad, fromSide=fromPortSide).createNiceConn() |
There was a problem hiding this comment.
get Connector first, use method after.
if a:
return xif b:
return y| def _runNiceConn( | ||
| connectorType, dpConnection, patchString, rad, segmentItemFactory, fromPortSide=None, operation="subtract" | ||
| ): | ||
| fullPatchString = "trnsysGUI.connection.getNiceConnector." + patchString + "._addGraphicsItems" |
There was a problem hiding this comment.
can we patch the object directly, without using strings?
Does the spy still exist then?
| toPortSide=2, | ||
| nrOfNewItems=9, | ||
| nSegsExpected=5, | ||
| xStartCoordsExpected=[0.0, 30.0, 30.0, 130.0, 130.0], |
There was a problem hiding this comment.
coords = [(xStartNode, yStartNode), (x1, y1), (x2, y2), ..., (xEndNode, yEndNode) ]








During code review, we noticed most of the niceConn functionality was massively duplicated code.
This refactoring is especially needed, because this behavior has been very buggy in the past.