We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e0a51a + 7b4eaf1 commit 3899988Copy full SHA for 3899988
test_code.py
@@ -0,0 +1,24 @@
1
+
2
+# Arquivo de teste para o pytest. Este exemplo inclui várias funções de teste e usa fixtures
3
+# do pytest para configuração e limpeza
4
+import pytest
5
6
+# Fixture para configuração e limpeza
7
+@pytest.fixture
8
+def setup_data():
9
+ print("\nSetup")
10
+ data = {"key1": "value1", "key2": "value2"}
11
+ yield data
12
+ print("\nCleanup")
13
14
+# Função de teste usando a fixture
15
+def test_key1(setup_data):
16
+ assert setup_data["key1"] == "value1"
17
18
+# Outra função de teste usando a fixture
19
+def test_key2(setup_data):
20
+ assert setup_data["key2"] == "value2"
21
22
+# Função de teste sem usar a fixture
23
+def test_addition():
24
+ assert 1 + 1 == 2
0 commit comments