Skip to content

Commit e7a64d8

Browse files
committed
Added missing parts for the comparison of STA objects
1 parent 0f3b872 commit e7a64d8

6 files changed

Lines changed: 22 additions & 5 deletions

File tree

frost_sta_client/model/datastream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def __setstate__(self, state):
313313
self.name = state.get("name", None)
314314
self.description = state.get("description", None)
315315
self.observation_type = state.get("observationType", None)
316-
self.properties = state.get("properties", None)
316+
self.properties = state.get("properties", {})
317317
if state.get("unitOfMeasurement", None) is not None:
318318
self.unit_of_measurement = frost_sta_client.model.ext.unitofmeasurement.UnitOfMeasurement()
319319
self.unit_of_measurement.__setstate__(state["unitOfMeasurement"])

frost_sta_client/model/ext/unitofmeasurement.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,16 @@ def __setstate__(self, state):
6868
self.symbol = state.get("symbol", None)
6969
self.definition = state.get("definition", None)
7070
self.name = state.get("name", None)
71+
72+
def __eq__(self, other):
73+
if other is None:
74+
return False
75+
if not isinstance(other, type(self)):
76+
return False
77+
if self.name != other.name:
78+
return False
79+
if self.definition != other.definition:
80+
return False
81+
if self.symbol != other.symbol:
82+
return False
83+
return True

frost_sta_client/model/feature_of_interest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def __setstate__(self, state):
190190
super().__setstate__(state)
191191
self.name = state.get("name", None)
192192
self.description = state.get("description", None)
193-
self.properties = state.get("properties", None)
193+
self.properties = state.get("properties", {})
194194
self.encoding_type = state.get("encodingType", None)
195195
self.feature = state.get("feature", None)
196196
if state.get("Observations", None) is not None and isinstance(state["Observations"], list):

frost_sta_client/model/location.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def __eq__(self, other):
199199
return False
200200
if self.encoding_type != other.encoding_type:
201201
return False
202+
if self.location != other.location:
203+
return False
204+
if self.properties != other.properties:
205+
return False
202206
return True
203207

204208
def __ne__(self, other):
@@ -227,7 +231,7 @@ def __setstate__(self, state):
227231
self.name = state.get("name", None)
228232
self.description = state.get("description", None)
229233
self.encoding_type = state.get("encodingType", None)
230-
self.properties = state.get("properties", None)
234+
self.properties = state.get("properties", {})
231235
if state.get("Things", None) is not None:
232236
entity_class = entity_type.EntityTypes['Thing']['class']
233237
self.things = utils.transform_json_to_entity_list(state['Things'], entity_class)

frost_sta_client/model/observedproperty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def __setstate__(self, state):
198198
self.name = state.get("name", None)
199199
self.description = state.get("description", None)
200200
self.definition = state.get("definition", None)
201-
self.properties = state.get("properties", None)
201+
self.properties = state.get("properties", {})
202202
if state.get("Datastreams", None) is not None and isinstance(state["Datastreams"], list):
203203
entity_class = entity_type.EntityTypes['Datastream']['class']
204204
self.datastreams = utils.transform_json_to_entity_list(state['Datastreams'], entity_class)

frost_sta_client/model/thing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def __setstate__(self, state):
266266
super().__setstate__(state)
267267
self.name = state.get("name", None)
268268
self.description = state.get("description", None)
269-
self.properties = state.get("properties", None)
269+
self.properties = state.get("properties", {})
270270

271271
if state.get("Locations", None) is not None and isinstance(state["Locations"], list):
272272
entity_class = entity_type.EntityTypes['Location']['class']

0 commit comments

Comments
 (0)