Ejemplo n.º 1
0
    def unserialize(cls, obj):

        p = cls(obj["name"], obj["genre"], obj["max_trunk_length"], obj["pot_water_capacity"], obj["available_water"])

        p.base_trunk = Trunk.unserialize(obj["plant"])

        return p
Ejemplo n.º 2
0
def test_serialization_unserialization():

    trunk = Trunk.randomize('a', 30, 60, 20)

    s = trunk.serialize()

    unserialized = Trunk.unserialize(s)

    assert trunk == unserialized