Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test_code.py
Original file line number Diff line number Diff line change
@@ -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