Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #29154 -- Corrected examples in pluralize template filter docstring and added tests. #9723

Merged
merged 1 commit into from Feb 23, 2018

Conversation

hramezani
Copy link
Member

Fix pluralize template filter and add some tests.

class PluralizeTests(SimpleTestCase):

@setup({'pluralize01': 'vote{{ value|pluralize }}'})
def test_pluralize01(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use meaningful test names, e.g. test_no_arguments.

Also I would have 3 tests and use a loop a subTest() to test the three cases for each template. For example:

tests = (('0', 'votes'), ...)
for value, expected in tests:
    with self.subTest(value=value):
        output = self.engine.render_to_string('pluralize01', {'value': value})
        self.assertEqual(output, expected)

@timgraham timgraham changed the title Fix pluralize template filter and add some tests. Corrected examples in pluralize template filter docstring and added tests. Feb 23, 2018
@hramezani
Copy link
Member Author

@timgraham thanks, requested changes done

@timgraham timgraham changed the title Corrected examples in pluralize template filter docstring and added tests. Fixed #29154 -- Corrected examples in pluralize template filter docstring and added tests. Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants