Skip to content

Commit

Permalink
Test dict serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
annatisch committed May 17, 2016
1 parent 51948d7 commit 05f68a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_complex(self):
self.assertEqual(2, intResult.field2)

# PUT primitive/integer
intRequest = IntWrapper(field1=-1, field2=2)
intRequest = {'field1':-1, 'field2':2}
client.primitive.put_int(intRequest)

# GET primitive/long
Expand All @@ -110,7 +110,7 @@ def test_complex(self):
self.assertEqual(-999511627788, longResult.field2)

# PUT primitive/long
longRequest = LongWrapper(field1=1099511627775, field2=-999511627788)
longRequest = {'field1':1099511627775, 'field2':-999511627788}
client.primitive.put_long(longRequest)

# GET primitive/float
Expand All @@ -128,8 +128,8 @@ def test_complex(self):
self.assertEqual(-5e-57, doubleResult.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose)

# PUT primitive/double
doubleRequest = DoubleWrapper(field1=3e-100)
doubleRequest.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = -5e-57
doubleRequest = {'field1':3e-100}
doubleRequest['field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose'] = -5e-57
client.primitive.put_double(doubleRequest);

# GET primitive/bool
Expand Down Expand Up @@ -269,14 +269,14 @@ def test_complex(self):
self.assertEqual("Tomato", inheritanceResult.hates[1].name)

# PUT inheritance/valid
request = Siamese(
id=2,
name="Siameeee",
color="green",
breed="persian",
hates=[Dog(id=1, name="Potato", food="tomato"),
request = {
'id': 2,
'name': "Siameeee",
'color': "green",
'breed': "persian",
'hates': [Dog(id=1, name="Potato", food="tomato"),
Dog(id=-1, name="Tomato", food="french fries")]
)
}
client.inheritance.put_valid(request)

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def test_flattening_array(self):
self.assertEqual("Resource3", result[2].name)

resourceArray = [
FlattenedProduct(
location = "West US",
tags = {"tag1":"value1", "tag2":"value3"}),
FlattenedProduct(
location = "Building 44")]
{
'location': "West US",
'tags': {"tag1":"value1", "tag2":"value3"}},
{
'location': "Building 44"}]

self.client.put_array(resourceArray)

Expand Down Expand Up @@ -117,15 +117,15 @@ def test_flattening_dictionary(self):
self.assertEqual("Resource3", resultDictionary["Product3"].name)

resourceDictionary = {
"Resource1": FlattenedProduct(
location = "West US",
tags = {"tag1":"value1", "tag2":"value3"},
pname = "Product1",
flattened_product_type = "Flat"),
"Resource2": FlattenedProduct(
location = "Building 44",
pname = "Product2",
flattened_product_type = "Flat")}
"Resource1": {
'location': "West US",
'tags': {"tag1":"value1", "tag2":"value3"},
'pname': "Product1",
'flattened_product_type': "Flat"},
"Resource2": {
'location': "Building 44",
'pname': "Product2",
'flattened_product_type': "Flat"}}

self.client.put_dictionary(resourceDictionary)

Expand Down

0 comments on commit 05f68a6

Please sign in to comment.