Tests should use meaningful data


Python clean test tip:

Your tests should use meaningful data in order to provide examples of how to use your code.

Examples:

from dataclasses import dataclass


@dataclass
class Car:
    manufacture: str
    model: str
    vin_number: str
    top_speed: int


class InMemoryCarRepository:
    def __init__(self):
        self._cars = []

    def add(self, car):
        self._cars.append(car)

    def get_by_vin_number(self, vin_number):
        return next(car for car in self._cars if car.vin_number == vin_number)


# BAD - non-existing manufacture and model, VIN number not matching manufacture and model, impossible to reach top speed
def test_added_car_can_be_retrieved_by_vin_number_():
    car = Car(manufacture="AAAA", model="BBB+", vin_number="2FTJW36M6LCA90573", top_speed=1600)
    repository = InMemoryCarRepository()
    repository.add(car)

    assert car == repository.get_by_vin_number(car.vin_number)


# GOOD
def test_added_car_can_be_retrieved_by_vin_number():
    car = Car(manufacture="Jeep", model="Wrangler", vin_number="1J4FA29P4YP728937", top_speed=160)
    repository = InMemoryCarRepository()
    repository.add(car)

    assert car == repository.get_by_vin_number(car.vin_number)