From 9efc51cc381e5187289a46920a5f355b597c1ba9 Mon Sep 17 00:00:00 2001 From: "snowplow-loop[bot]" Date: Mon, 20 Jul 2026 11:53:54 +0000 Subject: [PATCH] loop: implement snowplow-python-tracker (loop/3a307af295a281a9ba70f6d2fa691c78-snowplow-python-tracker-29740085620) --- snowplow_tracker/subject.py | 3 ++- snowplow_tracker/test/unit/test_subject.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/snowplow_tracker/subject.py b/snowplow_tracker/subject.py index cbf29aa8..20451360 100644 --- a/snowplow_tracker/subject.py +++ b/snowplow_tracker/subject.py @@ -83,9 +83,10 @@ def set_viewport(self, width: int, height: int) -> "Subject": def set_color_depth(self, depth: int) -> "Subject": """ :param depth: Depth of the color on the screen - :type depth: int + :type depth: int,>0 :rtype: subject """ + greater_than(depth, 0) self.standard_nv_pairs["cd"] = depth return self diff --git a/snowplow_tracker/test/unit/test_subject.py b/snowplow_tracker/test/unit/test_subject.py index 953a0a74..9aa792fc 100644 --- a/snowplow_tracker/test/unit/test_subject.py +++ b/snowplow_tracker/test/unit/test_subject.py @@ -87,6 +87,14 @@ def test_subject_1(self) -> None: with pytest.raises(KeyError): s.standard_nv_pairs["tnuid"] + def test_set_color_depth_rejects_non_positive(self) -> None: + s = _subject.Subject() + with pytest.raises(ValueError): + s.set_color_depth(0) + with pytest.raises(ValueError): + s.set_color_depth(-1) + s.set_color_depth(1) # positive value must succeed + def test_combine_subject(self) -> None: s = _subject.Subject() s.set_color_depth(10)