Complete the code to mark the 'Given' step in a pytest test function.
def test_addition(): # [1]: Setup numbers a = 2 b = 3 result = a + b assert result == 5
The 'Given' step sets up the initial context or data for the test.
Complete the code to mark the 'When' step where the action happens.
def test_subtraction(): a = 5 b = 3 # [1]: Perform subtraction result = a - b assert result == 2
The 'When' step describes the action or event being tested.
Fix the error in the 'Then' step comment describing the expected outcome.
def test_multiplication(): a = 4 b = 3 result = a * b # [1]: Check if result equals 12 assert result == 12
The 'Then' step verifies the expected result or outcome of the test.
Fill both blanks to complete the Given-When-Then comments in the test.
def test_division(): # [1]: Setup numbers numerator = 10 denominator = 2 # [2]: Perform division result = numerator / denominator assert result == 5
'Given' sets up the data, 'When' performs the action.
Fill all three blanks to complete the Given-When-Then pattern in the test function.
def test_string_upper(): # [1]: Setup input string input_str = "hello" # [2]: Convert string to uppercase result = input_str.upper() # [3]: Verify the result is uppercase assert result == "HELLO"
'Given' sets up data, 'When' performs action, 'Then' checks result.
