Python: Data driven testing

I love doing TDD – Test driven development.

Sharing a small code construct to include variety of data set in a concise manner without depending on any library

def double(n):
    return n*2

test_data = [
    (2 ,4),
    (4 ,8),
]

for given, expected in test_data:
    assert expected == double(given)
    print(f"Test passed for: given {given} and expected = {expected}")

Output on console
Test passed for: given 2 and expectation = 4
Test passed for: given 4 and expectation = 8