Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
c17337ed
Commit
c17337ed
authored
May 14, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test coverage for lang.get_plural_label
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
0afc18aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
weblate/lang/models.py
weblate/lang/models.py
+1
-1
weblate/lang/tests.py
weblate/lang/tests.py
+13
-0
No files found.
weblate/lang/models.py
View file @
c17337ed
...
...
@@ -397,7 +397,7 @@ class Language(models.Model, PercentMixin):
except
(
IndexError
,
KeyError
):
if
idx
==
0
:
return
_
(
'Singular'
)
elif
idx
==
0
:
elif
idx
==
1
:
return
_
(
'Plural'
)
return
_
(
'Plural form %d'
)
%
idx
...
...
weblate/lang/tests.py
View file @
c17337ed
...
...
@@ -207,6 +207,19 @@ class LanguagesTest(TestCase):
'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;'
)
def
test_plural_labels
(
self
):
lang
=
Language
.
objects
.
get
(
code
=
'cs'
)
self
.
assertEqual
(
lang
.
get_plural_label
(
0
),
'One'
)
self
.
assertEqual
(
lang
.
get_plural_label
(
1
),
'Few'
)
self
.
assertEqual
(
lang
.
get_plural_label
(
2
),
'Other'
)
def
test_plural_labels_invalid
(
self
):
lang
=
Language
.
objects
.
get
(
code
=
'cs'
)
lang
.
plural_type
=
-
1
self
.
assertEqual
(
lang
.
get_plural_label
(
0
),
'Singular'
)
self
.
assertEqual
(
lang
.
get_plural_label
(
1
),
'Plural'
)
self
.
assertEqual
(
lang
.
get_plural_label
(
2
),
'Plural form 2'
)
class
CommandTest
(
TestCase
):
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment