From 8dd2e7188e8d234d7895653a1b97460339392367 Mon Sep 17 00:00:00 2001 From: "snowplow-loop[bot]" Date: Mon, 20 Jul 2026 08:38:20 +0000 Subject: [PATCH] loop: implement snowplow-python-tracker (loop/3a307af295a281a9ba70f6d2fa691c78-snowplow-python-tracker-29728427289) --- 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..df77d15d 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_validation(self) -> None: + s = _subject.Subject() + with self.assertRaises(ValueError): + s.set_color_depth(0) + with self.assertRaises(ValueError): + s.set_color_depth(-1) + s.set_color_depth(24) # Valid — should not raise + def test_combine_subject(self) -> None: s = _subject.Subject() s.set_color_depth(10)