Skip to content
Snippets Groups Projects
Commit c7e4f34a authored by Felipe Delestro Matos's avatar Felipe Delestro Matos
Browse files

CI/CD

parent 9f3b2127
Branches
No related tags found
No related merge requests found
Pipeline #17514 passed
......@@ -5,12 +5,12 @@ This is an example repository of how Python projects should be organized as at Q
On the root of the repository, at minimum you should have:
- README.md
- LICENSE
- An `.gitignore` file (you can use the one from here as a base template)
- `.gitignore` file (you can use the one from here as a base template)
- A single `project_name` directory that contains all the main code
- requirements.txt (for the pip requirements)
Depending on your project, you might also have:
- y
- `.gitlab-ci.yml` for the CI/CD pipeline
### Code directory
Use a simple but meaningful name, as this is the name you're project is going to be imported in case it is packed as a library.
......@@ -25,8 +25,8 @@ Details of the coding guidelines can be found at the [QIM Gitlab Wiki](https://l
In summary:
- Use Google style for docstrings.
- Do not add files larger than 32MB, unless stricly necessary.
- Raise errors when necessary.
- Avoid large files.
## Testing
......
......@@ -11,7 +11,10 @@ def say_hello(user):
>>> say_hello('Alice')
'Hello Alice!'
"""
if not isinstance(user, str):
raise TypeError("The 'user' argument must be a string.")
greeting = (f'Hello {user}!')
str = (f'Hello {user}!')
return greeting
return str
\ No newline at end of file
import qimex
import pytest
def test_say_hello():
user = "Alice"
expected_output = "Hello Alice!"
result = qimex.examples.say_hello(user)
assert result == expected_output
\ No newline at end of file
assert result == expected_output
def test_say_hello_with_non_string():
""" Tests if the correct error is raised"""
user = 123 # Non-string argument
with pytest.raises(TypeError):
qimex.examples.say_hello(user)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment