From 27a832bbd1311898a4035de51c4cbf557ac0fbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Mon, 2 Dec 2024 14:18:53 +0100 Subject: [PATCH] client: adds ctx manager tests --- tests/client/test_client.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index ae29443..40e7a80 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -149,3 +149,15 @@ def test_tab_completion(pydase_client: pydase.Client) -> None: "sub_service", ] ) + + +def test_context_manager(pydase_client: pydase.Client) -> None: + client = pydase.Client(url="ws://localhost:9999") + + assert client.proxy.connected + + with client: + client.proxy.my_property = 1337.01 + assert client.proxy.my_property == 1337.01 + + assert not client.proxy.connected