/usr/lib/python2.7/dist-packages/pint/testsuite/test_babel.py is in python-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 33 34 35 36 37 38 39 40 41 | # -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, print_function, absolute_import
from pint.testsuite import helpers, BaseTestCase
from pint.testsuite.compat import unittest
from pint import UnitRegistry
import os
class TestBabel(BaseTestCase):
@helpers.requires_proper_babel()
@unittest.skip("Not working on Debian")
def test_babel(self):
ureg = UnitRegistry()
dirname = os.path.dirname(__file__)
ureg.load_definitions(os.path.join(dirname, '../xtranslated.txt'))
distance = 24.0 * ureg.meter
self.assertEqual(
distance.format_babel(locale='fr_FR', length='long'),
"24.0 mètres"
)
time = 8.0 * ureg.second
self.assertEqual(
time.format_babel(locale='fr_FR', length='long'),
"8.0 secondes"
)
self.assertEqual(
time.format_babel(locale='ro', length='short'),
"8.0 s"
)
acceleration = distance / time ** 2
self.assertEqual(
acceleration.format_babel(locale='fr_FR', length='long'),
"0.375 mètre par seconde²"
)
mks = ureg.get_system('mks')
self.assertEqual(
mks.format_babel(locale='fr_FR'),
"métrique"
)
|