From 17e8b801ad546747133532c646999c10067ea083 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:44:36 -0800 Subject: [PATCH] Add tests to catch colon in channel name regression. --- tests/test_async.py | 13 +++++++++++-- tests/test_sync.py | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/test_async.py b/tests/test_async.py index aa153d9..a1092c2 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -139,7 +139,13 @@ async def test_write_and_read_pending_writes_and_sends(self) -> None: assert result.checkpoint["pending_sends"] == ["w3v"] - @pytest.mark.parametrize("channel_values", [{"channel1": "channel1v"}, {}]) + @pytest.mark.parametrize( + "channel_values", + [ + {"channel1": "channel1v"}, + {}, # to catch regression reported in #10 + ], + ) async def test_write_and_read_channel_values( self, channel_values: dict[str, Any] ) -> None: @@ -155,7 +161,10 @@ async def test_write_and_read_channel_values( chkpnt["id"] = "4" chkpnt["channel_values"] = channel_values - newversions: ChannelVersions = {"channel1": 1} + newversions: ChannelVersions = { + "channel1": 1, + "channel:with:colon": 1, # to catch regression reported in #9 + } chkpnt["channel_versions"] = newversions await saver.aput(config, chkpnt, {}, newversions) diff --git a/tests/test_sync.py b/tests/test_sync.py index e49b2f7..c024237 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -138,7 +138,13 @@ def test_write_and_read_pending_writes_and_sends(self) -> None: assert result.checkpoint["pending_sends"] == ["w3v"] - @pytest.mark.parametrize("channel_values", [{"channel1": "channel1v"}, {}]) + @pytest.mark.parametrize( + "channel_values", + [ + {"channel1": "channel1v"}, + {}, # to catch regression reported in #10 + ], + ) def test_write_and_read_channel_values( self, channel_values: dict[str, Any] ) -> None: @@ -154,7 +160,10 @@ def test_write_and_read_channel_values( chkpnt["id"] = "4" chkpnt["channel_values"] = channel_values - newversions: ChannelVersions = {"channel1": 1} + newversions: ChannelVersions = { + "channel1": 1, + "channel:with:colon": 1, # to catch regression reported in #9 + } chkpnt["channel_versions"] = newversions saver.put(config, chkpnt, {}, newversions)