コード例 #1
0
def test_round5_color():
    """Test the round5 functions for cmyk and hsv."""
    # Tests for round5_cmyk (add one more)
    cornelltest.assert_equals(
        "(98.45, 25.36, 72.80, 25.00)", a3.round5_cmyk(colormodel.CMYK(98.448, 25.362, 72.8, 25.0))
    )
    cornelltest.assert_equals(
        "(30.64, 89.03, 3.090, 26.90)", a3.round5_cmyk(colormodel.CMYK(30.643, 89.029, 3.0900, 26.901))
    )
    # Tests for round5_hsv (add two)
    cornelltest.assert_equals("(300.0, 0.123, 0.576)", a3.round5_hsv(colormodel.HSV(300.0001, 0.12321, 0.5759)))
    cornelltest.assert_equals("(125.4, 0.875, 0.537)", a3.round5_hsv(colormodel.HSV(125.433, 0.8748, 0.53741)))
コード例 #2
0
def round5_cmyk(cmyk):
    """Proxy function for a3.round5_cmyk"""
    result = a3.round5_cmyk(cmyk)
    if result is None:
        return ''
    return result