def test_expected_string(self): """should produce the expected reference example""" s = color_gradient_string("#00000000", "#99999999", 9) expected = ":".join(["#" + str(i) * 8 + ";0.10" for i in range(10)]) assert s == expected
def test_ends_with_color(self): """string should end with provided colour""" s = color_gradient_string("#ffffff33", "#ffffffaa", 1) assert s.endswith("#ffffffaa;0.50")
def test_correct_num_steps(self): """string should have the correct number of steps""" for steps in range(1, 10): s = color_gradient_string("#ffffff33", "#ffffffaa", steps) assert s.count(":") == steps
def test_starts_with_color(self): """string should start with provided colour""" s = color_gradient_string("#ffffff33", "#ffffffaa", 30) assert s.startswith("#ffffff33")