def test_serialize_local_environment_with_labels(): env = environments.LocalEnvironment(labels=["bob", "alice"]) schema = RemoteEnvironmentSchema() serialized = schema.dump(env) assert serialized assert serialized["__version__"] == prefect.__version__ assert set(serialized["labels"]) == set(["bob", "alice"]) new = schema.load(serialized) assert new.labels == set(["bob", "alice"])
def test_serialize_local_environment_with_labels(): env = environments.LocalEnvironment(labels=["b", "c", "a"]) schema = RemoteEnvironmentSchema() serialized = schema.dump(env) assert serialized assert serialized["__version__"] == prefect.__version__ # labels should be sorted in the serialized obj assert serialized["labels"] == ["a", "b", "c"] new = schema.load(serialized) assert new.labels == {"b", "c", "a"}
def test_serialize_remote_environment(): env = environments.RemoteEnvironment() schema = RemoteEnvironmentSchema() serialized = schema.dump(env) assert serialized assert serialized["__version__"] == prefect.__version__ assert serialized["executor"] == prefect.config.engine.executor.default_class assert serialized["executor_kwargs"] == {} new = schema.load(serialized) assert new.executor == prefect.config.engine.executor.default_class assert new.executor_kwargs == {}
def test_serialize_remote_environment_with_labels(): env = environments.RemoteEnvironment(labels=["bob", "alice"]) schema = RemoteEnvironmentSchema() serialized = schema.dump(env) assert serialized assert serialized["__version__"] == prefect.__version__ assert serialized["executor"] == prefect.config.engine.executor.default_class assert serialized["executor_kwargs"] == {} assert set(serialized["labels"]) == set(["bob", "alice"]) new = schema.load(serialized) assert new.executor == prefect.config.engine.executor.default_class assert new.executor_kwargs == {} assert new.labels == set(["bob", "alice"])
def test_serialize_remote_environment_with_labels(): env = environments.RemoteEnvironment(labels=["b", "c", "a"]) schema = RemoteEnvironmentSchema() serialized = schema.dump(env) assert serialized assert serialized["__version__"] == prefect.__version__ assert serialized[ "executor"] == prefect.config.engine.executor.default_class assert serialized["executor_kwargs"] == {} # labels should be sorted in the serialized obj assert serialized["labels"] == ["a", "b", "c"] new = schema.load(serialized) assert new.executor == prefect.config.engine.executor.default_class assert new.executor_kwargs == {} assert new.labels == {"b", "c", "a"}