Skip to content

Commit

Permalink
Fix #1353 + msrest 0.4.2 (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel authored and tbombach committed Aug 16, 2016
1 parent 5ff4445 commit 91e07ab
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/client/Python/msrest/msrest/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ def serialize_object(self, attr, **kwargs):
:param dict attr: Object to be serialized.
:rtype: dict or str
"""
if attr is None:
return None
obj_type = type(attr)
if obj_type in self.basic_types:
return self.serialize_basic(attr, self.basic_types[obj_type])
Expand Down
2 changes: 1 addition & 1 deletion src/client/Python/msrest/msrest/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
# --------------------------------------------------------------------------


msrest_version = "0.4.1"
msrest_version = "0.4.2"
7 changes: 7 additions & 0 deletions src/client/Python/msrest/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ To install:
Release History
---------------

2016-08-15 Version 0.4.2
++++++++++++++++++++++++

**Bugfixes**

- Fix serialization if "object" type contains None (https://github.com/Azure/autorest/issues/1353)

2016-08-08 Version 0.4.1
++++++++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion src/client/Python/msrest/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

setup(
name='msrest',
version='0.4.1',
version='0.4.2',
author='Microsoft Corporation',
packages=['msrest'],
url=("https://github.com/xingwu1/autorest/tree/python/"
Expand Down
6 changes: 6 additions & 0 deletions src/client/Python/msrest/test/unittest_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ def setUp(self):
self.s = Serializer()
return super(TestRuntimeSerialized, self).setUp()

def test_obj_serialize_none(self):
"""Test that serialize None in object is still None.
"""
obj = self.s.serialize_object({'test': None})
self.assertIsNone(obj['test'])

def test_obj_without_attr_map(self):
"""
Test serializing an object with no attribute_map.
Expand Down

0 comments on commit 91e07ab

Please sign in to comment.