@@ -361,3 +361,31 @@ def test_compare_reports_unmeasured_score_without_formatting_none():
361361 assert "Overall score change: not available" in terminal_out
362362 assert "score change not available" in html_out
363363 assert "None" not in html_out
364+
365+
366+ def test_compare_does_not_render_negative_zero_share_delta ():
367+ """A tiny negative share_delta that rounds to 0.0 pp must not print as
368+ '-0.0 pp' in either the terminal or the HTML compare report."""
369+ result = {
370+ "score_delta" : 0 ,
371+ "a" : {"name" : "A" , "overall_score" : 100 , "n_rows" : 10000 , "grade" : "A" },
372+ "b" : {"name" : "B" , "overall_score" : 100 , "n_rows" : 10000 , "grade" : "A" },
373+ "added_dimensions" : [], "removed_dimensions" : [], "flags" : [],
374+ "dimensions" : [
375+ {
376+ "name" : "Gender" , "kind" : "Demographic" , "drift_level" : "none" ,
377+ "psi" : 0.0 , "tvd" : 0.0 ,
378+ "dimension_score_a" : 100 , "dimension_score_b" : 100 ,
379+ "dimension_score_delta" : 0 ,
380+ "groups" : [
381+ {"label" : "Female" , "status" : "shifted" ,
382+ "share_a" : 0.5 , "share_b" : 0.4999 , "share_delta" : - 0.0001 },
383+ {"label" : "Male" , "status" : "shifted" ,
384+ "share_a" : 0.5 , "share_b" : 0.5001 , "share_delta" : 0.0001 },
385+ ],
386+ }
387+ ],
388+ }
389+
390+ assert "-0.0 pp" not in compare_to_terminal (result )
391+ assert "-0.0 pp" not in compare_to_html (result )
0 commit comments