-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
triangle : add test template #2016
triangle : add test template #2016
Conversation
exercises/triangle/.meta/template.j2
Outdated
def test_{{ case["description"] | to_snake }}(self): | ||
input = {{ case["input"]["sides"] }} | ||
expected = {{ case["expected"] }} | ||
self.assertEqual({{ case["property"] }}(input), expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend putting everything inside the assertEqual
call instead of using the input
and expected
variables here. You can spread things out like so for template readability, and the generator will put everything on a single line in generation:
self.assertEqual(
{{ case["property"] }}({{ case["input"]["sides"] }}),
{{ case["expected"] }}
)
Made changes as requested. Thanks ! |
exercises/triangle/.meta/template.j2
Outdated
class {{ case["description"] | camel_case }}Test(unittest.TestCase): | ||
{% for case in case["cases"] %} | ||
def test_{{ case["description"] | to_snake }}(self): | ||
self.assertEqual({{ case["property"] }}({{ case["input"]["sides"] }}), {{ case["expected"] }}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, smaller diff let me see this one. From our conventions:
We use assertIs(actual, True) and assertIs(actual, False) rather than assertTrue(actual) or assertFalse(actual) (#419).
self.assertEqual({{ case["property"] }}({{ case["input"]["sides"] }}), {{ case["expected"] }}) | |
self.assertIs({{ case["property"] }}({{ case["input"]["sides"] }}), {{ case["expected"] }}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to assertIs as per conventions. Thanks.
No description provided.