Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Group
QIM
Manage
Activity
Members
Labels
Plan
Issues
Epics
Issue boards
Epic boards
Roadmap
Milestones
Iterations
Wiki
Code
Merge requests
Deploy
Package registry
Operate
Terraform modules
Analyze
Insights
Issue analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Wiki
Home
Coding standards
Changes
Page history
New page
Templates
Clone repository
Update Coding standards
authored
2 years ago
by
fima
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Home/Coding-standards.md
+6
-6
6 additions, 6 deletions
Home/Coding-standards.md
with
6 additions
and
6 deletions
Home/Coding-standards.md
View page @
0abefef4
...
...
@@ -53,26 +53,26 @@ example-repo/
Inside
`examples.py`
you could have this function:
```
python
def
say_hello
(
user
):
if
not
isinstance
(
user
,
str
):
raise
TypeError
(
"
The
'
user
'
argument must be a string.
"
)
def
say_hello
(
user
):
greeting
=
(
f
'
Hello
{
user
}
!
'
)
return
greeting
```
This function simply receives a string and returns another string greeting the user.
A
`test_examples.py`
should contain the test for it:
```
python
def
test_say_hello
():
"""
Checks default behaviour
"""
user
=
"
Alice
"
expected_output
=
"
Hello Alice!
"
result
=
qimex
.
examples
.
say_hello
(
user
)
result
=
qimex
.
examples
.
say_hello
(
"
Alice
"
)
assert
result
==
expected_output
```
This is simply running the function and checking if the result is as expected.
...
...
This diff is collapsed.
Click to expand it.