1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Unit tests for pytils' numeral templatetags for Django web framework
18 """
19
20 __id__ = __revision__ = "$Id: test_numeral.py 76 2007-02-27 15:38:53Z the.pythy $"
21 __url__ = "$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/test/templatetags/test_numeral.py $"
22
23 from pytils.test.templatetags import helpers
24
26
29
31 self.check_template_tag('choose_plural',
32 '{% load pytils_numeral %}{{ val|choose_plural:"гвоздь,гвоздя,гвоздей" }}',
33 {'val': 10},
34 'гвоздей')
35
37 self.check_template_tag('rubles',
38 '{% load pytils_numeral %}{{ val|rubles }}',
39 {'val': 10.1},
40 'десять рублей десять копеек')
41
43 self.check_template_tag('in_words',
44 '{% load pytils_numeral %}{{ val|in_words }}',
45 {'val': 21},
46 'двадцать один')
47
48 self.check_template_tag('in_words',
49 '{% load pytils_numeral %}{{ val|in_words:"NEUTER" }}',
50 {'val': 21},
51 'двадцать одно')
52
54 self.check_template_tag('sum_string',
55 '{% load pytils_numeral %}{% sum_string val "MALE" "пример,пример,примеров" %}',
56 {'val': 21},
57 'двадцать один пример')
58
59
61 self.check_template_tag('choose_plural_error',
62 '{% load pytils_numeral %}{{ val|choose_plural:"вариант" }}',
63 {'val': 1},
64 '')
65
66
67 if __name__ == '__main__':
68 import unittest
69 unittest.main()
70