Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
593b0387
Commit
593b0387
authored
Jan 29, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for django-comment-client helpers
parent
1f049410
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
lms/djangoapps/django_comment_client/helpers.py
+3
-0
lms/djangoapps/django_comment_client/tests/test_helpers.py
+15
-0
No files found.
lms/djangoapps/django_comment_client/helpers.py
View file @
593b0387
...
...
@@ -12,6 +12,9 @@ import pystache_custom as pystache
import
urllib
import
os
# This method is used to pluralize the words "discussion" and "comment"
# when referring to how many discussion threads or comments the user
# has contributed to.
def
pluralize
(
singular_term
,
count
):
if
int
(
count
)
>=
2
or
int
(
count
)
==
0
:
return
singular_term
+
's'
...
...
lms/djangoapps/django_comment_client/tests/test_helpers.py
0 → 100644
View file @
593b0387
import
string
import
random
import
collections
from
django.test
import
TestCase
from
django_comment_client.helpers
import
pluralize
class
PluralizeTestCase
(
TestCase
):
def
testPluralize
(
self
):
self
.
term
=
"cat"
self
.
assertEqual
(
pluralize
(
self
.
term
,
0
),
"cats"
)
self
.
assertEqual
(
pluralize
(
self
.
term
,
1
),
"cat"
)
self
.
assertEqual
(
pluralize
(
self
.
term
,
2
),
"cats"
)
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