This file is indexed.

/usr/lib/python3/dist-packages/pint/testsuite/test_infer_base_unit.py is in python3-pint 0.8.1-2.

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
from pint import UnitRegistry, set_application_registry
from pint.testsuite import QuantityTestCase
from pint.util import infer_base_unit

ureg = UnitRegistry()
set_application_registry(ureg)
Q = ureg.Quantity


class TestInferBaseUnit(QuantityTestCase):
    def test_infer_base_unit(self):
        from pint.util import infer_base_unit
        self.assertEqual(infer_base_unit(Q(1, 'millimeter * nanometer')), Q(1, 'meter**2').units)

    def test_units_adding_to_zero(self):
        self.assertEqual(infer_base_unit(Q(1, 'm * mm / m / um * s')), Q(1, 's').units)

    def test_to_compact(self):
        r = Q(1000000000, 'm') * Q(1, 'mm') / Q(1, 's') / Q(1, 'ms')
        compact_r = r.to_compact()
        expected = Q(1000., 'kilometer**2 / second**2')
        self.assertQuantityAlmostEqual(compact_r, expected)

        r = (Q(1, 'm') * Q(1, 'mm') / Q(1, 'm') / Q(2, 'um') * Q(2, 's')).to_compact()
        self.assertQuantityAlmostEqual(r, Q(1000, 's'))

    def test_volts(self):
        from pint.util import infer_base_unit
        r = Q(1, 'V') * Q(1, 'mV') / Q(1, 'kV')
        b = infer_base_unit(r)
        self.assertEqual(b, Q(1, 'V').units)
        self.assertQuantityAlmostEqual(r, Q(1, 'uV'))