This file is indexed.

/usr/lib/python3/dist-packages/defcon/test/objects/test_color.py is in python3-defcon 0.3.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import unittest
from defcon.objects.color import Color


class ColorTest(unittest.TestCase):

    def __init__(self, methodName):
        unittest.TestCase.__init__(self, methodName)

    def test_from_string(self):
        self.assertEqual(tuple(Color("1,1,1,1")), (1, 1, 1, 1))
        self.assertEqual(tuple(Color(".1,.1,.1,.1")),
                         (0.10000000000000001, 0.10000000000000001,
                          0.10000000000000001, 0.10000000000000001))
        self.assertEqual(tuple(Color("1, 1, 1, 1")), (1, 1, 1, 1))
        self.assertEqual(tuple(Color("0.1, 0.1, 0.1, 0.1")),
                         (0.10000000000000001, 0.10000000000000001,
                          0.10000000000000001, 0.10000000000000001))

    def test_from_tuple(self):
        self.assertEqual(tuple(Color((1, 1, 1, 1))), (1, 1, 1, 1))

    def test_to_string(self):
        self.assertEqual(Color((0, 0, 0, 0)), "0,0,0,0")
        self.assertEqual(Color((1, .1, .01, .001)), "1,0.1,0.01,0.001")
        self.assertEqual(Color((.0001, .00001, .000001, .000005)),
                         "0.0001,0.00001,0,0.00001")

    def test_to_sequence(self):
        self.assertEqual(tuple(Color((1, 1, 1, 1))), (1, 1, 1, 1))

    def test_component_attributes(self):
        c = Color((.1, .2, .3, .4))
        self.assertEqual(c.r, 0.10000000000000001)
        self.assertEqual(c.g, 0.20000000000000001)
        self.assertEqual(c.b, 0.29999999999999999)
        self.assertEqual(c.a, 0.40000000000000002)

    def test_invalid_values_negative(self):
        with self.assertRaises(
                ValueError,
                msg="The color for r (-1) is not between 0 and 1."):
            Color((-1, 0, 0, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for g (-1) is not between 0 and 1."):
            Color((0, -1, 0, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for b (-1) is not between 0 and 1."):
            Color((0, 0, -1, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for a (-1) is not between 0 and 1."):
            Color((0, 0, 0, -1))

    def test_invalid_values_too_large(self):
        with self.assertRaises(
                ValueError,
                msg="The color for r (2) is not between 0 and 1."):
            Color((2, 0, 0, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for g (2) is not between 0 and 1."):
            Color((0, 2, 0, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for b (2) is not between 0 and 1."):
            Color((0, 0, 2, 0))
        with self.assertRaises(
                ValueError,
                msg="The color for a (2) is not between 0 and 1."):
            Color((0, 0, 0, 2))

    def test_iterate_component_attributes(self):
        color = Color((0.1, 0.2, 0.3, 0.4))
        expected_values = (0.10000000000000001, 0.20000000000000001,
                           0.29999999999999999, 0.40000000000000002)
        for index, component_attribute in enumerate(color):
            self.assertEqual(component_attribute, expected_values[index])

if __name__ == "__main__":
    unittest.main()