@@ -309,3 +309,28 @@ def test_compact_view_primitive_siblings():
309309 "nested_sibling": {{...}}
310310}}'''
311311 assert result == expected
312+
313+
314+ def test_colored_view_bool_evaluation ():
315+ # Test COLORED_VIEW
316+ # Scenario 1: No differences
317+ t1_no_diff = {"a" : 1 , "b" : 2 }
318+ t2_no_diff = {"a" : 1 , "b" : 2 }
319+ diff_no_diff_colored = DeepDiff (t1_no_diff , t2_no_diff , view = COLORED_VIEW )
320+ assert not bool (diff_no_diff_colored ), "bool(diff) should be False when no diffs (colored view)"
321+
322+ # Scenario 2: With differences
323+ t1_with_diff = {"a" : 1 , "b" : 2 }
324+ t2_with_diff = {"a" : 1 , "b" : 3 }
325+ diff_with_diff_colored = DeepDiff (t1_with_diff , t2_with_diff , view = COLORED_VIEW )
326+ assert bool (diff_with_diff_colored ), "bool(diff) should be True when diffs exist (colored view)"
327+
328+ # Test COLORED_COMPACT_VIEW
329+ # Scenario 1: No differences
330+ diff_no_diff_compact = DeepDiff (t1_no_diff , t2_no_diff , view = COLORED_COMPACT_VIEW )
331+ assert not bool (diff_no_diff_compact ), "bool(diff) should be False when no diffs (compact view)"
332+
333+ # Scenario 2: With differences
334+ diff_with_diff_compact = DeepDiff (t1_with_diff , t2_with_diff , view = COLORED_COMPACT_VIEW )
335+ assert bool (diff_with_diff_compact ), "bool(diff) should be True when diffs exist (compact view)"
336+
0 commit comments