Example #1
0
    def test_near_zero_null(self):
        """
        Test very near zero null.

        This is a fix up to help give more sane hues
        when chroma is very close to zero.
        """

        c = Color('color(--lchuv 90% 0.000000000009 120 / 1)').convert(
            'luv').convert('lchuv')
        self.assertTrue(c.is_nan('hue'))
Example #2
0
    def test_null_normalization_min_chroma(self):
        """Test minimum saturation."""

        c = Color('color(--lchuv 90% 0 120 / 1)').normalize()
        self.assertTrue(c.is_nan('hue'))
Example #3
0
    def test_null_input(self):
        """Test null input."""

        c = Color('lchuv', [90, 50, NaN], 1)
        self.assertTrue(c.is_nan('hue'))
Example #4
0
    def test_none_input(self):
        """Test `none` null."""

        c = Color('color(--lchuv 90% 0 none / 1)')
        self.assertTrue(c.is_nan('hue'))
Example #5
0
    def test_null_normalization_min_sat(self):
        """Test minimum saturation."""

        c = Color('color(--okhsl 270 0% 0.75 / 1)').normalize()
        self.assertTrue(c.is_nan('hue'))
Example #6
0
    def test_null_normalization_min_light(self):
        """Test minimum lightness."""

        c = Color('color(--okhsl 270 20% 0% / 1)').normalize()
        self.assertTrue(c.is_nan('hue'))
Example #7
0
    def test_none_input(self):
        """Test `none` null."""

        c = Color('color(--okhsl none 0% 75% / 1)')
        self.assertTrue(c.is_nan('hue'))
Example #8
0
    def test_null_input(self):
        """Test null input."""

        c = Color('okhsl', [NaN, 0.5, 1], 1)
        self.assertTrue(c.is_nan('hue'))
Example #9
0
    def test_corner_case_null(self):
        """Test corner case that produces null."""

        c = Color('color(srgb -2 0 2)').convert('hsl')
        self.assertTrue(c.is_nan('hue'))
Example #10
0
    def test_null_normalization_max_light(self):
        """Test maximum lightness."""

        c = Color('hsl(270 20% 100% / 1)').normalize()
        self.assertTrue(c.is_nan('hue'))
Example #11
0
    def test_none_input(self):
        """Test `none` null."""

        c = Color('color(--hsv none 0% 0.75 / 1)')
        self.assertTrue(c.is_nan('hue'))