Skip to content

Commit

Permalink
fix(classname): Classname is no longer needed param
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdsouza committed Sep 3, 2019
1 parent a7f10ac commit fbdf3d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions ibm_cloud_sdk_core/base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,9 @@ def prepare_request(self, method, url, headers=None,


@staticmethod
def _convert_model(val, classname=None):
if classname is not None:
if isinstance(val, str):
val = json_import.loads(val)
def _convert_model(val):
if isinstance(val, str):
val = json_import.loads(val)
if hasattr(val, "_to_dict"):
return val._to_dict()
return val
Expand Down
2 changes: 1 addition & 1 deletion test/test_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def _from_dict(cls, _dict):
model1 = service._convert_model(mock)
assert model1 == {'x': 'foo'}

model2 = service._convert_model("{\"x\": \"foo\"}", MockModel)
model2 = service._convert_model("{\"x\": \"foo\"}")
assert model2 is not None
assert model2['x'] == 'foo'

Expand Down

0 comments on commit fbdf3d4

Please sign in to comment.