Beispiel #1
0
def test_serialize_deserialize_curronly(do):
    """
    test to_dict function for Wind object
    create a new wind object and make sure it has same properties
    """

    c_cats = CatsMover(curr_file)
    json_ = c_cats.serialize(do)
    dict_ = c_cats.deserialize(json_)
    if do == 'create':
        c2 = CatsMover.new_from_dict(dict_)
        assert c_cats == c2
    else:
        c_cats.from_dict(dict_)
Beispiel #2
0
def test_serialize_deserialize_tide(do):
    """
    test to_dict function for Wind object
    create a new wind object and make sure it has same properties
    """

    c_cats = CatsMover(curr_file, tide=td)
    json_ = c_cats.serialize(do)
    dict_ = c_cats.deserialize(json_)
    if do == 'create':
        dict_.update({'tide': td})
        c2 = CatsMover.new_from_dict(dict_)
        assert c_cats == c2
    else:
        assert json_['tide'] == td.serialize(do)
        c_cats.from_dict(dict_)
        assert c_cats.tide is td