This file is indexed.

/usr/lib/python3/dist-packages/pytils/test/templatetags/test_numeral.py is in python3-pytils 0.3-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
# -*- coding: utf-8 -*-
"""
Unit tests for pytils' numeral templatetags for Django web framework
"""

from pytils.test.templatetags import helpers


class NumeralDefaultTestCase(helpers.TemplateTagTestCase):

    def testLoad(self):
        self.check_template_tag('load_tag', u'{% load pytils_numeral %}', {}, u'')
    
    def testChoosePluralFilter(self):
        self.check_template_tag('choose_plural',
            u'{% load pytils_numeral %}{{ val|choose_plural:"гвоздь,гвоздя,гвоздей" }}',
            {'val': 10},
            u'гвоздей')

    def testGetPluralFilter(self):
        self.check_template_tag('get_plural',
            u'{% load pytils_numeral %}{{ val|get_plural:"гвоздь,гвоздя,гвоздей" }}',
            {'val': 10},
            u'10 гвоздей')
        self.check_template_tag('get_plural',
            u'{% load pytils_numeral %}{{ val|get_plural:"гвоздь,гвоздя,гвоздей" }}',
            {'val': 0},
            u'0 гвоздей')
        self.check_template_tag('get_plural',
            u'{% load pytils_numeral %}{{ val|get_plural:"гвоздь,гвоздя,гвоздей,нет гвоздей" }}',
            {'val': 0},
            u'нет гвоздей')
    
    def testRublesFilter(self):
        self.check_template_tag('rubles',
            u'{% load pytils_numeral %}{{ val|rubles }}',
            {'val': 10.1},
            u'десять рублей десять копеек')
    
    def testInWordsFilter(self):
        self.check_template_tag('in_words',
            u'{% load pytils_numeral %}{{ val|in_words }}',
            {'val': 21},
            u'двадцать один')

        self.check_template_tag('in_words',
            u'{% load pytils_numeral %}{{ val|in_words:"NEUTER" }}',
            {'val': 21},
            u'двадцать одно')
    
    def testSumStringTag(self):
        self.check_template_tag('sum_string',
            u'{% load pytils_numeral %}{% sum_string val "MALE" "пример,пример,примеров" %}',
            {'val': 21},
            u'двадцать один пример')
        
        self.check_template_tag('sum_string_w_gender',
            u'{% load pytils_numeral %}{% sum_string val male variants %}',
            {
             'val': 21,
             'male':'MALE',
             'variants': ('пример','пример','примеров')
             },
            u'двадцать один пример')

    # без отладки, если ошибка -- по умолчанию пустая строка
    def testChoosePluralError(self):
        self.check_template_tag('choose_plural_error',
            u'{% load pytils_numeral %}{{ val|choose_plural:"вариант" }}',
            {'val': 1},
            u'')


if __name__ == '__main__':
    import unittest
    unittest.main()