From c7e4f34a8a2fb7f23dd644a9bf1cf91edd80355c Mon Sep 17 00:00:00 2001
From: Felipe Delestro Matos <fima@pop-os.localdomain>
Date: Wed, 14 Jun 2023 15:17:47 +0200
Subject: [PATCH] CI/CD

---
 README.md              |  8 ++++----
 qimex/examples.py      |  7 +++++--
 tests/test_examples.py | 10 ++++++++--
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 8c581df..af74e92 100644
--- a/README.md
+++ b/README.md
@@ -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
 
diff --git a/qimex/examples.py b/qimex/examples.py
index 288e484..b3b8b92 100644
--- a/qimex/examples.py
+++ b/qimex/examples.py
@@ -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
diff --git a/tests/test_examples.py b/tests/test_examples.py
index b5c8da1..0dede1b 100644
--- a/tests/test_examples.py
+++ b/tests/test_examples.py
@@ -1,8 +1,14 @@
 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
-- 
GitLab