From 7b4eaf1c7075d131ee2f4f53b3773ab9bb22a0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiana=20=F0=9F=9A=80=20=20Campanari?= <113218619+FabianaCampanari@users.noreply.github.com> Date: Fri, 14 Mar 2025 00:12:46 -0300 Subject: [PATCH] Create test_code.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabiana 🚀 Campanari <113218619+FabianaCampanari@users.noreply.github.com> --- test_code.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test_code.py diff --git a/test_code.py b/test_code.py new file mode 100644 index 0000000..e2e6b84 --- /dev/null +++ b/test_code.py @@ -0,0 +1,24 @@ + +# Arquivo de teste para o pytest. Este exemplo inclui várias funções de teste e usa fixtures +# do pytest para configuração e limpeza +import pytest + +# Fixture para configuração e limpeza +@pytest.fixture +def setup_data(): + print("\nSetup") + data = {"key1": "value1", "key2": "value2"} + yield data + print("\nCleanup") + +# Função de teste usando a fixture +def test_key1(setup_data): + assert setup_data["key1"] == "value1" + +# Outra função de teste usando a fixture +def test_key2(setup_data): + assert setup_data["key2"] == "value2" + +# Função de teste sem usar a fixture +def test_addition(): + assert 1 + 1 == 2