本文整理匯總了Python中gnome.environment.Waves.deserialize方法的典型用法代碼示例。如果您正苦於以下問題:Python Waves.deserialize方法的具體用法?Python Waves.deserialize怎麽用?Python Waves.deserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnome.environment.Waves
的用法示例。
在下文中一共展示了Waves.deserialize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: deserialize
# 需要導入模塊: from gnome.environment import Waves [as 別名]
# 或者: from gnome.environment.Waves import deserialize [as 別名]
def deserialize(cls, json_):
"""
ChemicalDispersion could include 'waves'.
"""
schema = cls._schema()
_to_dict = schema.deserialize(json_)
if "waves" in json_ and json_["waves"] is not None:
_to_dict["waves"] = Waves.deserialize(json_["waves"])
return _to_dict
示例2: test_serialize_deseriailize
# 需要導入模塊: from gnome.environment import Waves [as 別名]
# 或者: from gnome.environment.Waves import deserialize [as 別名]
def test_serialize_deseriailize():
'test serialize/deserialize for webapi'
wind = constant_wind(1., 0)
water = Water()
w = Waves(wind, water)
json_ = w.serialize()
# deserialize and ensure the dict's are correct
w2 = Waves.deserialize(json_)
assert w2.wind == Wind.deserialize(json_['wind'])
assert w2.water == Water.deserialize(json_['water'])
assert w == w2
示例3: test_serialize_deseriailize
# 需要導入模塊: from gnome.environment import Waves [as 別名]
# 或者: from gnome.environment.Waves import deserialize [as 別名]
def test_serialize_deseriailize():
"test serialize/deserialize for webapi"
wind = constant_wind(1.0, 0)
water = Water()
w = Waves(wind, water)
json_ = w.serialize()
json_["wind"] = wind.serialize()
json_["water"] = water.serialize()
# deserialize and ensure the dict's are correct
d_ = Waves.deserialize(json_)
print "d_"
print d_
assert d_["wind"] == Wind.deserialize(json_["wind"])
assert d_["water"] == Water.deserialize(json_["water"])
d_["wind"] = wind
d_["water"] = water
w.update_from_dict(d_)
assert w.wind is wind
assert w.water is water