This file is indexed.

/usr/lib/python2.7/dist-packages/zope/i18n/locales/tests/test_xmlfactory.py is in python-zope.i18n 4.1.0-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
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTLAR PURPOSE.
#
##############################################################################
"""Testing all XML Locale functionality.
"""
import os
from unittest import TestCase, TestSuite, makeSuite, main

from zope.i18n.locales.xmlfactory import LocaleFactory
from zope.i18n.format import parseDateTimePattern, parseNumberPattern
import zope.i18n

class LocaleXMLFileTestCase(TestCase):
    """This test verifies that every locale XML file can be loaded."""

    # only run when running tests of level 2
    level = 2

    def __init__(self, path):
        self.__path = path
        TestCase.__init__(self)
        
    def runTest(self):
        # Loading Locale object
        locale = LocaleFactory(self.__path)()

        # XXX: The tests below are commented out because it's not
        # necessary for the xml files to have all format definitions.
        
        ## Making sure all number format patterns parse
        #for category in (u'decimal', u'scientific', u'percent', u'currency'):
        #    for length in getattr(locale.numbers, category+'Formats').values():
        #        for format in length.formats.values():
        #            self.assert_(parseNumberPattern(format.pattern) is not None)

        ## Making sure all datetime patterns parse
        #for calendar in locale.dates.calendars.values():
        #    for category in ('date', 'time', 'dateTime'):
        #        for length in getattr(calendar, category+'Formats').values():
        #            for format in length.formats.values():
        #                self.assert_(
        #                    parseDateTimePattern(format.pattern) is not None)
                
                    

def test_suite():
   suite = TestSuite()
   locale_dir = os.path.join(os.path.dirname(zope.i18n.__file__),
                             'locales', 'data')
   for path in os.listdir(locale_dir):
       if not path.endswith(".xml"):
           continue
       path = os.path.join(locale_dir, path)
       case = LocaleXMLFileTestCase(path)
       suite.addTest(case)
   return suite

if __name__ == '__main__':
    main(defaultTest='test_suite')