def test_str5_color():
    """Test the str5 functions for cmyk and hsv."""
    cornelltest.assert_equals('(98.45, 25.36, 99.99, 21.99)',\
            a3.str5_cmyk(colormodel.CMYK(98.448, 25.362, 99.99, 21.994)));
    
    cornelltest.assert_equals('(32.33, 6.355, 0.001, 10.01)',\
    a3.str5_cmyk(colormodel.CMYK(32.3256, 6.3546, .0013, 10.013567)))
Beispiel #2
0
def test_str5_color():
    """
    Test the str5 functions for cmyk and hsv.
    """
    print('Testing str5_cmyk and str5_hsv')
    # Tests for str5_cmyk
    # We need to make sure the coordinates round properly
    text = a3.str5_cmyk(introcs.CMYK(98.448, 25.362, 72.8, 1.0))
    introcs.assert_equals('(98.45, 25.36, 72.80, 1.000)',text)
    #another test
    text = a3.str5_cmyk(introcs.CMYK(0.0, 1.5273, 100.0, 57.846))
    introcs.assert_equals('(0.000, 1.527, 100.0, 57.85)',text)
    # Tests for str5_hsv (add two)
    text = a3.str5_hsv(introcs.HSV(98.448, 0.123456789, 0.0))
    introcs.assert_equals('(98.45, 0.123, 0.000)',text)

    text = a3.str5_hsv(introcs.HSV(0.0,0.313725490196,1.0))
    introcs.assert_equals('(0.000, 0.314, 1.000)',text)
    #test max value for H
    text = a3.str5_hsv(introcs.HSV(359.99,1.0,1.0))
    introcs.assert_equals('(360.0, 1.000, 1.000)',text)
    #test min values
    text = a3.str5_hsv(introcs.HSV(0.0,0.0,0.0))
    introcs.assert_equals('(0.000, 0.000, 0.000)',text)
    print('Tests for str5_cmyk and str5_hsv passed')
Beispiel #3
0
def test_str5_color():
    """Test the str5 functions for cmyk and hsv."""
    cornelltest.assert_equals(
        '(98.45, 25.36, 72.80, 1.000)',
        a3.str5_cmyk(colormodel.CMYK(98.448, 25.362, 72.8, 1.0)))
    cornelltest.assert_equals(
        '(1.000, 100.0, 23.12, 54.44)',
        a3.str5_cmyk(colormodel.CMYK(1, 100, 23.12345, 54.435)))
    cornelltest.assert_equals('(98.45, 0.000, 0.123)',
                              a3.str5_hsv(colormodel.HSV(98.448, 0, .123456)))
    cornelltest.assert_equals('(312.0, 0.500, 0.568)',
                              a3.str5_hsv(colormodel.HSV(312, 0.5, 0.56789)))
def test_str5_color():
    """Test the str5 functions for cmyk and hsv."""
    cornelltest.assert_equals(
        '(98.45, 25.36, 72.80, 1.000)',
        a3.str5_cmyk(colormodel.CMYK(98.448, 25.362, 72.8, 1.0)))
    cornelltest.assert_equals(
        '(100.0, 0.225, 83.50, 0.000)',
        a3.str5_cmyk(colormodel.CMYK(100.0, .2245, 83.5, 0.0)))
    cornelltest.assert_equals(
        '(56.00, 0.000, 0.987)',
        a3.str5_hsv(colormodel.HSV(55.999, 0.0, 0.9874234353442)))
    cornelltest.assert_equals(
        '(250.4, 1.000, 0.488)',
        a3.str5_hsv(colormodel.HSV(250.356, 1.0, .4878325345)))
Beispiel #5
0
def test_str5_color():
    """
    Test the str5 functions for cmyk and hsv.
    """
    cornell.assert_equals('(98.45, 25.36, 72.80, 1.000)',
                          a3.str5_cmyk(cornell.CMYK(98.448, 25.362, 72.8, 1.0)))
    cornell.assert_equals('(1.000, 0.000, 100.0, 100.0)',
                          a3.str5_cmyk(cornell.CMYK(1, 0.0, 99.999999, 100)))
    cornell.assert_equals('(0.000, 0.000, 0.000)',
                          a3.str5_hsv(cornell.HSV(0, 0.0, 0)))
    cornell.assert_equals('(360.0, 1.000, 1.000)',
                          a3.str5_hsv(cornell.HSV(359.999, 1.0, 1)))
    cornell.assert_equals('(279.5, 1.000, 0.735)',
                          a3.str5_hsv(cornell.HSV(279.547, 1, 0.7346983)))
Beispiel #6
0
def test_str5_color():
    """
    Test the str5 functions for cmyk and hsv.
    """
    cornell.assert_equals(
        '(98.45, 25.36, 72.80, 1.000)',
        a3.str5_cmyk(cornell.CMYK(98.448, 25.362, 72.8, 1.0)))
Beispiel #7
0
def str5_cmyk(cmyk):
    """
    Proxy function for a3.str5_cmyk
    """
    result = a3.str5_cmyk(cmyk)
    if result is None:
        return ''
    return result
Beispiel #8
0
def test_str5_color():
    """
    Test the str5 functions for cmyk and hsv.
    """
    cornell.assert_equals(
        '(98.45, 25.36, 72.80, 1.000)',
        a3.str5_cmyk(cornell.CMYK(98.448, 25.362, 72.8, 1.0)))
    #cornell.assert_equals('(98.45, 25.36, 72.80, 1.000)',
    #                      a3.str5_cmyk(cornell.CMYK(98.448, 25.362, 72.8, 1.0)))
    cornell.assert_equals('(0.000, 0.314, 1.000)',
                          a3.str5_hsv(cornell.HSV(0.0, 0.313725490196, 1.0)))
    cornell.assert_equals('(0.500, 0.666, 1.000)',
                          a3.str5_hsv(cornell.HSV(0.5, 0.666352839474, 1)))