You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Describe the bug
To ensure that validation of attributes happens every time they're set, we should use @propertygetters/setters for attributes requiring validation.
To Reproduce
n/a
Expected behavior
Use @property getters/setters to validate instance attributes - e.g. here:
def__init__(self, client, order_id):
"""Instantiate an order change request creation."""self._client=clientself._order_id=order_idself._slices= []
OrderChangeRequestCreate._validate_order_id(self._order_id)
def_validate_order_id(order_id):
"""Set order ID"""iftype(order_id) isnotstr:
raiseOrderChangeRequestCreate.InvalidOrderId(order_id)
can be changed to:
def__init__(self, client, order_id):
"""Instantiate an order change request creation."""self.client=clientself.order_id=order_idself.slices= []
@propertydeforder_id(self):
returnself._order_id@order_id.setterdeforder_id(self, value):
ifnotisinstance(value, str):
raiseOrderChangeRequestCreate.InvalidOrderId(value)
self._order_id=value
System (please complete the following information):
n/a
Additional context
Could also fix this issue at the same time!