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
26 changes: 26 additions & 0 deletions test_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


#Test file for pytest. This example includes several test functions and uses pytest fixtures for setup and teardown.

import pytest
# Setup for configuration and cleanup
@pytest.fixture
def setup_data():
print("\nSetup")
data = {"key1": "value1", "key2": "value2"}
yield data
print("\nCleanup")

# Test function using the fixture
def test_key1(setup_data):
assert setup_data["key1"] == "value1"

# Another test function using the fixture
def test_key2(setup_data):
assert setup_data["key2"] == "value2"

# Test function without using the fixture
def test_addition():
assert 1 + 1 == 2