From a3c5a476703457d303345007ea383d39a04d09fb Mon Sep 17 00:00:00 2001 From: "snowplow-loop[bot]" Date: Mon, 20 Jul 2026 08:24:47 +0000 Subject: [PATCH] loop: implement snowplow-python-tracker (loop/3a307af295a281a9ba70f6d2fa691c78-snowplow-python-tracker-29727716248) --- snowplow_tracker/subject.py | 3 ++- snowplow_tracker/test/unit/test_subject.py | 10 ++++++++++ 2 files changed, 12 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..91dd618c 100644 --- a/snowplow_tracker/test/unit/test_subject.py +++ b/snowplow_tracker/test/unit/test_subject.py @@ -87,6 +87,16 @@ def test_subject_1(self) -> None: with pytest.raises(KeyError): s.standard_nv_pairs["tnuid"] + def test_set_color_depth_validation(self) -> None: + s = _subject.Subject() + with pytest.raises(ValueError): + s.set_color_depth(0) + with pytest.raises(ValueError): + s.set_color_depth(-1) + # Positive value must still work + s.set_color_depth(24) + self.assertEqual(s.standard_nv_pairs["cd"], 24) + def test_combine_subject(self) -> None: s = _subject.Subject() s.set_color_depth(10)