示例#1
0
    def test_model_rt(self, uncertain):
        model = make_model(uncertain)
        serial = model.serialize()
        m2 = Model.deserialize(serial)

        # update the dict so it gives a valid model to load
        assert m2 == model
        print m2
    def test_model_rt(self, uncertain):
        model = make_model(uncertain)
        serial = model.serialize()
        m2 = Model.deserialize(serial)

        # update the dict so it gives a valid model to load
        assert m2 == model
        print m2
示例#3
0
    def test_model_rt(self, images_dir, uncertain):
        model = make_model(images_dir, uncertain)
        deserial = Model.deserialize(model.serialize('webapi'))

        # update the dict so it gives a valid model to load
        deserial['map'] = model.map
        for coll in ['movers', 'weatherers', 'environment', 'outputters',
                     'spills']:
            for ix, item in enumerate(deserial[coll]):
                deserial[coll][ix] = getattr(model, coll)[item['id']]

        m2 = Model.new_from_dict(deserial)
        assert m2 == model
        print m2
示例#4
0
    def test_model_rt(self, uncertain):
        model = make_model(uncertain)
        serial = model.serialize('webapi')
        deserial = Model.deserialize(serial)

        # update the dict so it gives a valid model to load
        deserial['map'] = model.map
        water = model.find_by_attr('_ref_as', 'water', model.environment)
        deserial['water'] = water
        for coll in ['movers', 'weatherers', 'environment', 'outputters',
                     'spills']:
            for ix, item in enumerate(deserial[coll]):
                deserial[coll][ix] = getattr(model, coll)[item['id']]

        m2 = Model.new_from_dict(deserial)
        assert m2 == model
        print m2
示例#5
0
    def test_model_rt(self, uncertain):
        model = make_model(uncertain)
        serial = model.serialize('webapi')
        deserial = Model.deserialize(serial)

        # update the dict so it gives a valid model to load
        deserial['map'] = model.map
        water = model.find_by_attr('_ref_as', 'water', model.environment)
        deserial['water'] = water
        for coll in ['movers', 'weatherers', 'environment', 'outputters',
                     'spills']:
            for ix, item in enumerate(deserial[coll]):
                deserial[coll][ix] = getattr(model, coll)[item['id']]

        m2 = Model.new_from_dict(deserial)
        assert m2 == model
        print m2
示例#6
0
 def get_json(mdl):
     json_ = Model.deserialize(mdl.serialize('webapi'))
     json_['map'] = mdl.map
     return json_